Created
March 31, 2022 11:19
-
-
Save justdamilare/d5b5bd72d02114b1e1ce2896688b6343 to your computer and use it in GitHub Desktop.
Boxplot of Boreal Forest (in R) using only the std, mean (as median) and the percentiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
df <- data.frame(mean=c(-15.3847,-13.8345,-15.6586,-12.9021,-14.8223), | |
sd=c(0.8202, 1.0819,1.1738,1.4993,1.4620), | |
q1=c(-15.9060,-14.6200,-16.3240,-14.2200,-16.1340), | |
q3=c(-14.8207,-13.0962,-15.0522,-11.7610,-13.7840), | |
Year=as.factor(c(2017,2018,2019,2020,2021))) | |
df | |
plot <- ggplot(df,aes(x=Year))+geom_boxplot(aes(lower=q1,upper=q3,middle=mean, | |
ymin=q1 - 1.5*(q3-q1), | |
ymax=q3+1.5*(q3-q1)), | |
stat="identity") | |
plot + ggtitle("Plot of Boreal Forest") + xlab("x-axis") + ylab("y-axis") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment