How to share the range of a numeric variable in legend color in ggplot2?

ggplot2
#1

Goal

I want to plot the weather of the nearest weather station to a given highway. Obviously, the weather changes drastically in different seasons. So, when I plot the temperature with a colored legend, the range is different for the same color palette. How can I use 1 legend that represents the correct temperature range for all plots?

This is an example for 2 months. The range of temp_c is different for the same color.

Rplot

Reproducible example

CODE:

# Function to create plots -------------------
create_map2 <-  function(month_no) {
  plot_title <- my_data %>% 
    filter(month == month_no) %>% pull(month_name) %>% unique()
  ggplot() +
    # geom_sf(data = ontario,
    #         fill = "white") +
    # coord_sf(crs = st_crs(4326),
    #          ylim = c(42, 51)) +
    geom_point(data = my_data %>% 
                 filter(month == month_no), 
               mapping = aes(x = X, y = Y, color = temp_c)) +
    labs(x = "Longitude", y = "Latitude") +
    ggtitle(label = plot_title) +
    scale_color_viridis_c(option = "inferno", direction = 1)
  
}

create_map2(1)


# Creating all plots ------------------------
all_plots2 <- purrr::map(na.omit(unique(my_data$month)), ~ create_map2(.x))

# Combining plots -----------------------------------
plotz2 <- cowplot::plot_grid(plotlist = all_plots2)

DATA

dput(my_data)
structure(list(nearest_weather_station_ID_2017 = c(53000, 53000, 
53000, 53000, 53000, 53000, 53000, 53000, 53000, 53000, 53000, 
53000, 31367, 31367, 31367, 31367, 31367, 31367, 7868, 7868, 
7868, 7868, 7868, 7868, 7868, 7868, 7868, 7868, 7868, 7868, 7868, 
7868, 7868, 7868, 7868, 7868, 51459, 51459, 51459, 51459, 51459, 
51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 
51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 
51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 
51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 
51459, 53000, 53000, 53000, 53000, 51459, 51459, 51459, 51459, 
51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 
51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 
51459, 51459, 53000, 53000, 53000, 53000, 51459, 51459, 51459, 
51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 
51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 51459, 
51459, 51459, 51459, 7868, 7868), month = c(1, 12, 1, 12, 1, 
12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 
12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 
12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 
12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 
12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 
12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 
12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 
12, 1, 12, 1, 12), month_name = structure(c(1L, 12L, 1L, 12L, 
1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 
1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 
1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 
1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 
1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 
1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 
1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 
1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 
1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 1L, 12L, 
1L, 12L, 1L, 12L, 1L, 12L), .Label = c("Jan", "Feb", "Mar", "Apr", 
"May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"), class = c("ordered", 
"factor")), X = c(-79.1206284, -79.1206284, -79.1348649, -79.1348649, 
-79.1521931, -79.1521931, -79.194578, -79.194578, -79.2215773, 
-79.2215773, -79.239631, -79.239631, -79.3503484, -79.3503484, 
-79.3733226, -79.3733226, -79.3948445, -79.3948445, -79.7941257, 
-79.7941257, -79.8112616, -79.8112616, -79.8253035, -79.8253035, 
-79.8235521, -79.8235521, -79.8096043, -79.8096043, -79.7991724, 
-79.7991724, -79.7816208, -79.7816208, -79.7718636, -79.7718636, 
-79.7563718, -79.7563718, -79.5783878, -79.5783878, -79.5680909, 
-79.5680909, -79.5546024, -79.5546024, -79.5488565, -79.5488565, 
-79.6335256, -79.6335256, -79.6377237, -79.6377237, -79.7659232, 
-79.7659232, -79.6820163, -79.6820163, -79.5731599, -79.5731599, 
-79.5765562, -79.5765562, -79.5361756, -79.5361756, -79.5552055, 
-79.5552055, -79.5604779, -79.5604779, -79.5694487, -79.5694487, 
-79.5842796, -79.5842796, -79.6069602, -79.6069602, -79.6455293, 
-79.6455293, -79.6613403, -79.6613403, -79.6954632, -79.6954632, 
-79.6469266, -79.6469266, -79.6368963, -79.6368963, -79.0543316, 
-79.0543316, -79.1119731, -79.1119731, -79.5591934, -79.5591934, 
-79.5733785, -79.5733785, -79.5890369, -79.5890369, -79.6051577, 
-79.6051577, -79.6083151, -79.6083151, -79.6689924, -79.6689924, 
-79.6842742, -79.6842742, -79.6948494, -79.6948494, -79.7280379, 
-79.7280379, -79.7370403, -79.7370403, -79.7417823, -79.7417823, 
-79.7518746, -79.7518746, -79.0850167, -79.0850167, -79.0992466, 
-79.0992466, -79.5485686, -79.5485686, -79.5488876, -79.5488876, 
-79.5502264, -79.5502264, -79.5622289, -79.5622289, -79.5668269, 
-79.5668269, -79.5681943, -79.5681943, -79.5917132, -79.5917132, 
-79.6060454, -79.6060454, -79.6106834, -79.6106834, -79.6247254, 
-79.6247254, -79.6305885, -79.6305885, -79.6318304, -79.6318304, 
-79.7943543, -79.7943543), Y = c(43.1209496, 43.1209496, 43.1385916, 
43.1385916, 43.1528106, 43.1528106, 43.1673487, 43.1673487, 43.1709843, 
43.1709843, 43.1749357, 43.1749357, 43.1794428, 43.1794428, 43.1849301, 
43.1849301, 43.1866004, 43.1866004, 43.2933749, 43.2933749, 43.3176848, 
43.3176848, 43.327595, 43.327595, 43.3410295, 43.3410295, 43.347595, 
43.347595, 43.3561782, 43.3561782, 43.3720288, 43.3720288, 43.3809595, 
43.3809595, 43.3952454, 43.3952454, 43.5877758, 43.5877758, 43.5972656, 
43.5972656, 43.6093779, 43.6093779, 43.6135975, 43.6135975, 43.7703683, 
43.7703683, 43.7693771, 43.7693771, 43.7250413, 43.7250413, 43.628248, 
43.628248, 43.670571, 43.670571, 43.6762151, 43.6762151, 43.7133782, 
43.7133782, 43.7078757, 43.7078757, 43.7021449, 43.7021449, 43.691865, 
43.691865, 43.6712789, 43.6712789, 43.6630514, 43.6630514, 43.645255, 
43.645255, 43.6389583, 43.6389583, 43.6256349, 43.6256349, 43.62889, 
43.62889, 43.6080463, 43.6080463, 43.1571576, 43.1571576, 43.1495181, 
43.1495181, 43.7054043, 43.7054043, 43.699277, 43.699277, 43.6975832, 
43.6975832, 43.6973244, 43.6973244, 43.6968097, 43.6968097, 43.6458743, 
43.6458743, 43.6572656, 43.6572656, 43.6651429, 43.6651429, 43.6982445, 
43.6982445, 43.704859, 43.704859, 43.7083303, 43.7083303, 43.7157475, 
43.7157475, 43.0962295, 43.0962295, 43.0960886, 43.0960886, 43.6100252, 
43.6100252, 43.6146166, 43.6146166, 43.6164356, 43.6164356, 43.6434239, 
43.6434239, 43.6533082, 43.6533082, 43.6559772, 43.6559772, 43.6746624, 
43.6746624, 43.6956646, 43.6956646, 43.7029569, 43.7029569, 43.7269326, 
43.7269326, 43.7503164, 43.7503164, 43.7566459, 43.7566459, 43.2922133, 
43.2922133), temp_c = c(-0.636302294197031, -3.14099462365591, 
-0.636302294197031, -3.14099462365591, -0.636302294197031, -3.14099462365591, 
-0.636302294197031, -3.14099462365591, -0.636302294197031, -3.14099462365591, 
-0.636302294197031, -3.14099462365591, -0.477150537634409, -2.93724696356275, 
-0.477150537634409, -2.93724696356275, -0.477150537634409, -2.93724696356275, 
-0.348924731182796, -2.80456989247312, -0.348924731182796, -2.80456989247312, 
-0.348924731182796, -2.80456989247312, -0.348924731182796, -2.80456989247312, 
-0.348924731182796, -2.80456989247312, -0.348924731182796, -2.80456989247312, 
-0.348924731182796, -2.80456989247312, -0.348924731182796, -2.80456989247312, 
-0.348924731182796, -2.80456989247312, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-0.636302294197031, -3.14099462365591, -0.636302294197031, -3.14099462365591, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-0.636302294197031, -3.14099462365591, -0.636302294197031, -3.14099462365591, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-1.52620967741935, -4.76908602150538, -1.52620967741935, -4.76908602150538, 
-0.348924731182796, -2.80456989247312), geometry = structure(list(
    structure(c(-79.1206284, 43.1209496), class = c("XY", "POINT", 
    "sfg")), structure(c(-79.1206284, 43.1209496), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.1348649, 43.1385916), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.1348649, 43.1385916), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.1521931, 43.1528106), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.1521931, 43.1528106), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.194578, 43.1673487), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.194578, 43.1673487), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.2215773, 43.1709843), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.2215773, 43.1709843), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.239631, 43.1749357), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.239631, 43.1749357), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.3503484, 43.1794428), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.3503484, 43.1794428), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.3733226, 43.1849301), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.3733226, 43.1849301), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.3948445, 43.1866004), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.3948445, 43.1866004), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7941257, 43.2933749), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7941257, 43.2933749), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.8112616, 43.3176848), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.8112616, 43.3176848), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.8253035, 43.327595), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.8253035, 43.327595), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.8235521, 43.3410295), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.8235521, 43.3410295), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.8096043, 43.347595), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.8096043, 43.347595), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7991724, 43.3561782), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7991724, 43.3561782), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7816208, 43.3720288), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7816208, 43.3720288), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7718636, 43.3809595), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7718636, 43.3809595), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7563718, 43.3952454), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7563718, 43.3952454), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5783878, 43.5877758), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5783878, 43.5877758), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5680909, 43.5972656), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5680909, 43.5972656), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5546024, 43.6093779), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5546024, 43.6093779), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5488565, 43.6135975), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5488565, 43.6135975), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6335256, 43.7703683), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6335256, 43.7703683), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6377237, 43.7693771), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6377237, 43.7693771), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7659232, 43.7250413), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7659232, 43.7250413), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6820163, 43.628248), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6820163, 43.628248), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5731599, 43.670571), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5731599, 43.670571), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5765562, 43.6762151), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5765562, 43.6762151), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5361756, 43.7133782), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5361756, 43.7133782), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5552055, 43.7078757), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5552055, 43.7078757), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5604779, 43.7021449), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5604779, 43.7021449), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5694487, 43.691865), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5694487, 43.691865), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5842796, 43.6712789), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5842796, 43.6712789), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6069602, 43.6630514), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6069602, 43.6630514), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6455293, 43.645255), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6455293, 43.645255), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6613403, 43.6389583), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6613403, 43.6389583), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6954632, 43.6256349), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6954632, 43.6256349), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6469266, 43.62889), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6469266, 43.62889), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6368963, 43.6080463), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6368963, 43.6080463), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.0543316, 43.1571576), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.0543316, 43.1571576), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.1119731, 43.1495181), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.1119731, 43.1495181), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5591934, 43.7054043), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5591934, 43.7054043), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5733785, 43.699277), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5733785, 43.699277), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5890369, 43.6975832), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5890369, 43.6975832), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6051577, 43.6973244), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6051577, 43.6973244), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6083151, 43.6968097), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6083151, 43.6968097), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6689924, 43.6458743), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6689924, 43.6458743), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6842742, 43.6572656), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6842742, 43.6572656), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6948494, 43.6651429), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6948494, 43.6651429), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7280379, 43.6982445), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7280379, 43.6982445), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7370403, 43.704859), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7370403, 43.704859), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7417823, 43.7083303), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7417823, 43.7083303), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7518746, 43.7157475), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7518746, 43.7157475), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.0850167, 43.0962295), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.0850167, 43.0962295), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.0992466, 43.0960886), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.0992466, 43.0960886), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5485686, 43.6100252), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5485686, 43.6100252), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5488876, 43.6146166), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5488876, 43.6146166), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5502264, 43.6164356), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5502264, 43.6164356), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5622289, 43.6434239), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5622289, 43.6434239), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5668269, 43.6533082), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5668269, 43.6533082), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5681943, 43.6559772), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5681943, 43.6559772), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5917132, 43.6746624), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.5917132, 43.6746624), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6060454, 43.6956646), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6060454, 43.6956646), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6106834, 43.7029569), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6106834, 43.7029569), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6247254, 43.7269326), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6247254, 43.7269326), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6305885, 43.7503164), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6305885, 43.7503164), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6318304, 43.7566459), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.6318304, 43.7566459), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7943543, 43.2922133), class = c("XY", 
    "POINT", "sfg")), structure(c(-79.7943543, 43.2922133), class = c("XY", 
    "POINT", "sfg"))), class = c("sfc_POINT", "sfc"), precision = 0, bbox = structure(c(-79.8253035, 
43.0960886, -79.0543316, 43.7703683), .Names = c("xmin", "ymin", 
"xmax", "ymax"), class = "bbox"), crs = structure(list(epsg = 4326L, 
    proj4string = "+proj=longlat +datum=WGS84 +no_defs"), .Names = c("epsg", 
"proj4string"), class = "crs"), n_empty = 0L)), .Names = c("nearest_weather_station_ID_2017", 
"month", "month_name", "X", "Y", "temp_c", "geometry"), row.names = c(NA, 
-136L), class = c("sf", "data.frame"), sf_column = "geometry", agr = structure(c(NA_integer_, 
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_
), .Names = c("nearest_weather_station_ID_2017", "month", "month_name", 
"X", "Y", "temp_c"), .Label = c("constant", "aggregate", "identity"
), class = "factor"))

Note: Because of no response so far, I have cross-posted on stackoverflow: https://stackoverflow.com/questions/54564529/how-to-share-the-continuous-variable-legend-between-several-ggplots

0 Likes

#2

I should have used facet_wrap instead of purrr and cowplot. This was pointed out in a comment on stackoverflow (linked in the question).

0 Likes

#3

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

0 Likes

closed #4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

0 Likes