[R] Geom ribbon

Thomas Subia tg@77m @end|ng |rom y@hoo@com
Sat Jul 9 17:11:50 CEST 2022


Colleagues,
I am plotting tolerance ratios by location and dateMy reproducible code is:
library(ggplot2)
library(cowplot)

# tolerance ratio 
day1 <- runif(3)
day2 <- runif(3)
day3 <-runif(3)
location <- c("A","B","C")

df <- data.frame(location,day1,day2,day3)

# plot of tolerance ratio by location and day
myplot <-ggplot(df,aes(location,day1))+geom_point()+
  geom_point(aes(location,day2))+
  ylab("Tolerance ratio")+
  xlab("Location")+
  theme_cowplot()+
  ggtitle("Tolerance ratio by location and day")
I need to shade the areas between the following y data

Tolerance
Ratio > 0.6                        area shaded = red        Unacceptable
0.3 <= Ratio <= 0.6           light red                     Inadequate
0.25 <= Ratio < 0.3            yellow                       Marginal0.2 <= Ratio < 0.25            light green                 Good
Ratio < 0.2                           green                        Great
I believe that using geom_ribbon may work for this.
Any suggestions for this would be appreciated.
All the best,
Thomas Subia


	[[alternative HTML version deleted]]



More information about the R-help mailing list