diff --git a/findex/src/plot_utils.R b/findex/src/plot_utils.R index f5f7aa3ced54bfce156fd46bd7421346547c6350..b8a41e8a0ed8c4bf53c900f9d5d8db8d1ae2b12f 100644 --- a/findex/src/plot_utils.R +++ b/findex/src/plot_utils.R @@ -19,22 +19,27 @@ threat_map <- ggplot()+ geom_sf(data = filtered_df, aes(geometry = Shape, fill = MeanWeightedThreatMetric, color = MeanWeightedThreatMetric))+ scale_fill_gradientn( colors = colorRampPalette(c(rev(unlist(pal))))(100), - limits = c(0, max(filtered_df$MeanWeightedThreatMetric)), - na.value=NA + limits = c(0, max(filtered_df$MeanWeightedThreatMetric, na.rm = T)), + na.value = "gray80", + breaks = c(0 + max(filtered_df$MeanWeightedThreatMetric, na.rm = T)/10, + #max(habitat_data$MeanWeightedThreatMetric)/2, + max(filtered_df$MeanWeightedThreatMetric, na.rm = T) - max(filtered_df$MeanWeightedThreatMetric, na.rm = T)/10), + labels = c("Lower", "Higher") )+ scale_color_gradientn( colors = colorRampPalette(c(rev(unlist(pal))))(100), - na.value=NA + na.value= "gray80" )+ guides(color = "none")+ - guides(fill = guide_colorbar(title.position = "top", - direction = "vertical", - barwidth = 1, - barheight = 5))+ + guides(fill = guide_colorbar(title = "Mean Threat", + title.position = "top", + direction = "horizontal", + barwidth = 7, + barheight = 1))+ theme_void()+ theme( legend.position = c(0.1, 0.21), - legend.title = element_blank() + legend.ticks = element_blank() ) ggsave(out_file, height = 6, width = 10, dpi = 300)