Skip to content
Snippets Groups Projects
Commit c25d7993 authored by Vaarre-Lamoureux, Kaysa S's avatar Vaarre-Lamoureux, Kaysa S
Browse files

plain text legend, gray for NA values

parent 2ea5013b
No related branches found
No related tags found
1 merge request!86Findex global maps
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment