<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif;font-size:small;color:#000000">Buen día a todos, muchas gracias por la ayuda en cuanto a la presentación de diversos gráficos.</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small;color:#000000">Me gustó mucho el paquete patchwork, lo estoy usando para combinar la leyenda, pero ha sido difícil. Estoy graficando datos espaciales y no todos tienen la misma escala de colores, al ocurrir esto, creo que no se puede combinar la leyenda por medio de plot_layout(guides = 'collect'). ¿Alguien sabe de casualidad cómo reescalar estos valores y poder tener solo una leyenda? ¿O también se les ocurre una alternativa para realizar esto? Quedo muy atento a sus comentarios, gracias.</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small;color:#000000"><b>Resultado: </b><br><img src="cid:ii_lik8vczh0" alt="image.png" width="515" height="326"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small;color:#000000"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small;color:#000000"><b>Código:<br><br></b>cpath <- "C:/Users/David Gomez/Desktop/TESIS/DATOS/Shapes/CUENCA_120m.shp"<br>border <- st_read(cpath)<br>font_add(family = "CMU Serif", regular = "cmunrm.ttf")<br>showtext_auto()<br><b><br></b>nina_raster <- function(raster_path, title, yr) {<br> raster_obj <- rast(raster_path) %>% <br> terra::project("epsg:9377") %>% <br> raster() %>% <br> as("SpatialPixelsDataFrame") %>% <br> as.data.frame()<br> <br> colnames(raster_obj) <- c("value", "x", "y")<br> value_min <- min(raster_obj$value, na.rm = TRUE)<br> value_max <- max(raster_obj$value, na.rm = TRUE)<br> value_mid <- (value_min + value_max) / 2<br> <br> plot <- ggplot() +<br> geom_tile(data = raster_obj, aes(x = x, y = y, fill = value)) +<br> geom_sf(data = border, fill = NA, color = "black") +<br> coord_sf() +<br> scale_fill_viridis(option = "mako", <br> na.value = "transparent",<br> breaks = c(value_min, value_mid, value_max),<br> labels = function(x) sprintf("%.2f", x),<br> direction = -1) +<br> labs(title = NULL,<br> subtitle = NULL,<br> x = NULL,<br> y = NULL,<br> fill = NULL) +<br> theme_bw() +<br> theme(text = element_text(family = "CMU Serif", size = 14),<br> plot.title = element_blank(), #modified<br> plot.subtitle = element_blank(), #modified<br> legend.position = "right", #modified<br> legend.title = element_text(size = 14, face = "bold"),<br> legend.text = element_text(size = 12),<br> legend.key = element_rect(colour = "black", linewidth = 0.5),<br> legend.title.align = 0.5,<br> axis.text.x = element_blank(),<br> axis.text.y = element_blank(),<br> axis.ticks = element_blank(),<br> axis.title = element_blank()) + #modified<br> geom_text(x = 0, y = 0, label = "my label", <br> size = 6, family = "CMU Serif")<br> <br> return(plot)<br>}<br><b><br></b>nina_plot_1 <- nina_raster("RESULTS/REC_A/REC_1/2010-REC_1.tif", <br> "Chaturvedi Methodology", "2010")<br>nina_plot_2 <- nina_raster("RESULTS/REC_A/REC_2/2010-REC_2.tif", <br> "U.P. Irrigation Research Institute Methodology",<br> "2010")<br>nina_plot_3 <- nina_raster("RESULTS/REC_A/REC_3/2010-REC_3.tif", <br> "Amritsar Methodology", "2010")<br>nina_plot_4 <- nina_raster("RESULTS/RAS_SCH/REC_A/2010-REC_A.tif", <br> "Schosinsky and Losilla Methodology", "2010")<b><br></b></div></div>
<br>
<b style="color:rgb(34,34,34);font-family:Calibri,sans-serif;font-size:14.6667px;font-style:normal;letter-spacing:normal;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255)"><span style="font-size:6.5pt;line-height:9.96667px;font-family:"Ancizar Sans",sans-serif;color:black">Aviso legal:</span></b><span style="font-style:normal;font-weight:400;letter-spacing:normal;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);font-size:6.5pt;line-height:9.96667px;font-family:"Ancizar Sans",sans-serif;color:black"> El contenido de este mensaje y los archivos adjuntos son confidenciales y de uso exclusivo de la Universidad Nacional de Colombia. Se encuentran dirigidos sólo para el uso del destinatario al cual van enviados. La reproducción, lectura y/o copia se encuentran prohibidas a cualquier persona diferente a este y puede ser ilegal. Si usted lo ha recibido por error, infórmenos y elimínelo de su correo. Los Datos Personales serán tratados conforme a la Ley 1581 de 2012 y a nuestra Política de Datos Personales que podrá consultar en la página web </span><span style="color:rgb(34,34,34);font-family:Calibri,sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);font-size:6.5pt;line-height:9.96667px"><a href="http://www.unal.edu.co/" style="color:blue" target="_blank"><span style="font-family:"Ancizar Sans",sans-serif">www.unal.edu.co</span></a></span><span style="font-style:normal;font-weight:400;letter-spacing:normal;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);font-size:6.5pt;line-height:9.96667px;font-family:"Ancizar Sans",sans-serif;color:black">.<u><span> </span></u>Las opiniones, informaciones, conclusiones y cualquier otro tipo de dato contenido en este correo electrónico, no relacionados con la actividad de la Universidad Nacional de Colombia, se entenderá como personales y de ninguna manera son avaladas por la Universidad.</span><br><span style="color:rgb(245,132,111);font-family:ClearSans-Regular,Arial,Verdana,Helvetica,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);display:inline!important;float:none"><span></span></span><span style="color:rgb(245,132,111);font-family:ClearSans-Regular,Arial,Verdana,Helvetica,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);display:inline!important;float:none"><span></span></span>