liupeng23的个人博客分享 http://blog.sciencenet.cn/u/liupeng23

博文

[转载]ggplot画图1

已有 1725 次阅读 2019-5-27 21:29 |系统分类:科研笔记|文章来源:转载

重要!!!  加载包: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

Rplot.bmp

实例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")#无图例

3.bmp

实例n:待续.......




https://blog.sciencenet.cn/blog-3306552-1181520.html

上一篇:[转载]开始学习python数据处理+绘图
下一篇:[转载]R语言中数据的导入与导出(笔记)
收藏 IP: 1.185.11.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (1 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-23 15:10

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部