首页 > 分享 > R语言可视化(十二)

R语言可视化(十二)

最新推荐文章于 2024-08-29 12:42:53 发布

dltan 于 2020-01-07 17:41:22 发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

ggplot2折线图

> library(ggplot2) > > N<-20 df1 <- data.frame(x=sort(rnorm(N)),y=sort(rnorm(N))) df2 <- > data.frame(x=df1$x+0.1*rnorm(N),y=df1$y+0.1*rnorm(N)) 1234

所有图层共享数据源和美学映射参数

> ggplot(df1,aes(x,y,colour=x+y))+ geom_line(size=1)+ > geom_point(shape=16,size=5)+ > guides(color=guide_colorbar(title="PointnLine")) 123

在这里插入图片描述
#所有图层仅共享数据源

ggplot(df1,aes(x,y))+ geom_line(aes(colour=x+y),size=1)+ geom_point(aes(fill=x+y),color="black",shape=21, size=5)+ scale_fill_distiller(name="Point",palette="YlOrRd")+ scale_color_distiller(name="Line",palette="Blues") 123456

在这里插入图片描述

#各图层对象均使用独立的数据源与美学映射参数

ggplot()+ geom_line(aes(x,y,colour=x+y),df1,size=1)+ geom_point(aes(x,y,fill=x+y),df2,color="black", shape=21, size=5)+ scale_fill_distiller(name="Point",palette="YlOrRd")+ scale_color_distiller(name="Line",palette="Blues") 123456

在这里插入图片描述
参考资料1:https://github.com/EasyChart/Beautiful-Visualization-with-R/

参考资料2:https://blog.csdn.net/tandelin/article/details/87719623

相关知识

用R 语言,进行静态绘图和 Shiny 的交互可视化演示
R语言“
R语言鸢尾花iris数据集的层次聚类分析 – 拓端
R语言数据分析案例:鸢尾花(IRIS)
R语言的apply族函数
R语言实现LDA算法(鸢尾花)
基于R语言的害虫预测算法设计
R语言生态学数据分析
时间序列分析秘籍:R语言中的timeDate数据包季节性调整指南
【机器学习】随机森林处理数据实践(基于R语言)

网址: R语言可视化(十二) https://m.huajiangbk.com/newsview702195.html

所属分类:花卉
上一篇: 深入理解BootStrap
下一篇: 【作业】第五章课后作业