library(ggplot2)
# create a data frame
variety=rep(LETTERS[1:7], each=40)
treatment=rep(c("high","low"),each=20)
note=seq(1:280)+sample(1:150, 280, replace=T)
data=data.frame(variety, treatment , note)
# https://blog.csdn.net/Judezhl/article/details/108592803 字体类型设置
# https://zhuanlan.zhihu.com/p/548042858 字体大小设置
# grouped boxplot
fig = ggplot(data, aes(x=variety, y=note, fill=treatment))
+labs(title="Miles per gallon according to the weight",x="type", y = "number")
+geom_boxplot()
+ theme_classic() # 去除背景
+theme(text=element_text("serif"),
plot.title = element_text(hjust = 0.5,size = 20), # 标题属性
axis.title = element_text(hjust = 0.5,size = 15))# 坐标轴属性
fig.png
http://r-graph-gallery.com/
https://plotly.com/r/
https://r-charts.com/
网友评论