ggplot edition add information

how could i add values to the gradient 1- 4
1 = -5 ° C to 0 ° C
2 = 0°C - 3°C"
3 = 3°C - 6°C
4 = 6°C - 10°C

ggplot_calendar_heatmap(temp_min_max_zmvm, "date", "interval_min",
dayBorderColour = "grey",
dayBorderSize = 0.2,
monthBorderColour = "grey",
monthBorderSize = 1.5) +
labs(title = "Concentraciones máximas de O3",
subtitle = "ZMVM 2020",
x="Mes",
y="Día",
fill = "Concentración O3") +
scale_fill_gradient(low = "green", high = "red")

Is this the sort of thing you want to do? I think it is confusing to label the gradient legend with ranges but it can be done.

#Invent data
set.seed(1)
DF <- data.frame(x=rep(1:4,4),y=rep(1:4,each=4),Conc=runif(16,min=1,max=4))

#Make plot
library(ggplot2)
ggplot(DF,aes(x=x,y=y,fill=Conc))+geom_tile()+
  scale_fill_gradient(low = "green", high = "red",
                      limits=c(1,4),
                      breaks=1:4,
                      labels=c("-5 - 0","0 - 3","3 - 6","6 - 10"))

Created on 2021-01-27 by the reprex package (v0.3.0)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.