0

I've plotted point data of parakeet observations (fake for now) across the UK with the observations coloured by the population density of the area the observation was made in. I have a continuous scale bar as I want but the scale itself is awkwardly annotated. How can I plot it with more even dividers?

Here is the code:

############################ #PLOT OBSERVATIONS x POP_DENS ############################

ggplot() +
  geom_polygon(data = UK, aes(x=long, y = lat, group = group), fill="gray14", alpha=0.7) +
  geom_point(data=paratweets_4, aes(x=coords.x1, y=coords.x2, color=pop_dens, shape=Occupancy), size=2,stroke=FALSE) +
  scale_color_viridis(option="magma", trans="log", name="Human Population Density (km2)") +
  theme_minimal() + ylim(50,59) + coord_map() + 
  ggtitle("Parakeet Observations") 

Here is the map: enter image description here

JoshuaAJones
  • 316
  • 1
  • 2
  • 7

1 Answers1

0

One strategy would be to make a column for the scale bar, with a metric that makes sense to you. For example,

df %>% 
  mutate(scale_column = case_when(
    pop_dens == 0 ~ "0",
    pop_dens > 0 & pop_dens < 100 ~ "0-100",
    pop_dens > 100 & pop_dens < 1000 ~ "100-999",
    pop_dens > 1000 & pop_dens < 2000 ~ "1000-1999",
  ))

Then using that column as your scale. Another option would be to modify the breaks of the scales. However, I would argue that in this case it might make sense to not have scale by color, but rather change the size of the points.

mhovd
  • 3,724
  • 2
  • 21
  • 47