0

I am getting this contour plot, but I need the values <-1.5 to be distinct from >-1.5 because it makes a difference in identifying which are the years of interest. However, since values like -1.54 and -1.4 are so close to each other, the contour map is showing same shade for both values. However,they mean different things. Hence, i want to change the colors based on my own breaks/bins

ggplot(spei_years, aes(Year, Month, z = SPEI)) +
  geom_contour_fill(na.fill = TRUE, show.legend = NA) +
  scale_fill_gradientn(
    colors= c("darkred", "red", "pink","black","white", "blue"),
    breaks = c(-4, -1.6,-1.5,-1.4,-1.3, 3),
    labels = c(-4, -1.6,-1.5,-1.4,-1.3, 3),
    limits = range(-4, 3)) +.....
  

enter image description here

I tried this and the values don't differentate from lesser than -1.5 and higher than -1.5.

I also tried this,

ggplot(spei_years, aes(Year, Month, z = SPEI)) +
  geom_contour_fill(na.fill = TRUE, show.legend = NA) +
   scale_fill_gradientn(
    colours = c("red4", "darkred", "orange", "darkgreen", "darkblue"),
    breaks = seq(-3, 3, length.out = 3),
    labels = seq(-3, 3, length.out = 3),
    limits = range(-4, 3)
  ) + ...

enter image description here

In both these figures, for 2021, the values are orangish just like 2019. However, the data does not say that. In the data, for 2021 the values from May to August are all more negative than -1.5. (-1.54) and for 2019 it is (-1.34). I understand the values are close to each other, hence the color looks similar, however, the values mean different things because as soon as >-1.5( 1.34) it is not more a matter of concern

0 Answers0