ggplot2箱线图可视化
可视化百度云资料链接为:
链接:https://pan.baidu.com/s/1JIAWYvEZeRftRJFYSFJrwg
提取码:hu5s
> library(ggplot2) library(RColorBrewer)
>
>
> color_theme<-brewer.pal(7,"Set2")[c(1,2,4,5)]
>
> mydata<-read.csv("Data.csv",stringsAsFactors=FALSE)
>
>
> ggplot(mydata, aes(Class, Value))+ geom_boxplot(aes(fill =
> Class),size=0.25) + geom_jitter(width=0.2,size=1.)+
> #geom_dotplot(aes(fill = Class),binaxis = "y", stackdir = "center",dotsize = 0.4)+
> scale_fill_manual(values=c("#4F81BD","#C0504D","#9BBB59","#8064A2"))+
> theme_bw()+ theme(legend.position="none")
> ggplot(mydata, aes(Class, Value))+ geom_boxplot(aes(fill =
> Class),size=0.25) + geom_jitter(width=0.2,size=1.)+
> #geom_dotplot(aes(fill = Class),binaxis = "y", stackdir = "center",dotsize = 0.4)+
> scale_fill_manual(values=c("#FF0000","#0000FF","#00FFFF","#FF00FF"))+
> theme_bw()+ theme(legend.position="none")
> ggplot(mydata, aes(Class, Value))+ geom_boxplot(aes(fill =
> Class),size=0.25,outlier.color=NA) + geom_jitter(width=0.2,size=1.)+
> theme_bw()+ theme(legend.position="none")
参考资料1:https://github.com/EasyChart/Beautiful-Visualization-with-R/
参考资料2:https://blog.csdn.net/tandelin/article/details/87719623