||
重要!!! 加载包:install.packages("ggplot2")
install.packages("画图包")
library(ggplot2)
50个画图实例:http://r-statistics.co/Top50-Ggplot2-Visualizations-MasterList-R-Code.html
https://blog.csdn.net/u014801157/article/details/24372531
https://blog.csdn.net/weixin_34378969/article/details/86919569
https://blog.csdn.net/kmd8d5r/article/details/79386843
http://www.360doc.com/content/16/1007/17/37047351_596461157.shtml
https://www.cnblogs.com/tecdat/p/9647003.html
https://bbs.pinggu.org/thread-5298857-1-1.html
http://www.sohu.com/a/224303554_466874
https://blog.csdn.net/qq_27755195/article/details/52105087
https://www.jianshu.com/p/3ec860e87832
https://www.jianshu.com/p/6dad9219fb8b
https://www.jianshu.com/p/2fb1bbc211c3
百度教程+CSDN教程+论坛+help+QQ群
实例1:
base <- ggplot(mpg, aes(cty, hwy, color = factor(cyl))) +
geom_jitter() +
geom_abline(colour = "grey50", size = 2)
base
实例2:
drugs <- data.frame(
drug = c("a", "b", "c"),
effect = c(4.2, 9.7, 6.1)
)
ggplot(drugs, aes(drug, effect)) + geom_bar(stat = "identity")
ggplot(drugs, aes(drug, effect)) + geom_point()
实例3:
#利用数据集mtcars演示head(mtcars)#先创建p图层p<- ggplot(data=mtcars, aes(x=wt, y=mpg))+ geom_point(aes(color=factor(cyl)))#先试试图例修改p+theme(legend.position = "none")#无图例
实例n:待续.......
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-23 15:10
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社