查看原文
其他

R可视化——拓展:个性散点图绘制

王志山 科研后花园 2023-09-08

在之前的推文中小编给大家展示过如何绘制散点图,今天,小编给大家展示的内容是对之前散点图的一部分拓展——将散点图中的散点换成俏皮可爱的图案。当然,这种图案虽然有趣,对于日常组会汇报可能有点用,但科研论文发表一定慎用,毕竟学术还是要以严谨为主。

基础散点图绘制

#加载R包library(ggplot2)#绘图——数据以iris数据集为例p1<-ggplot(iris,aes(Sepal.Length,Sepal.Width,color=Species))+geom_point()+theme_bw()p1

geomlime包

1、安装并加载geomlime包

remotes::install_github("coolbutuseless/geomlime")library(geomlime)

2、绘图——基于geomlime包中的geom_lime()和geom_pint()函数:

p1+geom_lime(size = 4)+theme(legend.position = 'none')

p1+geom_pint(size = 4)+theme(legend.position = 'none')


emoGG包

1、安装并加载emoGG包

remotes::install_github("dill/emoGG")library(emoGG)

2、绘图——基于emoGG包中的geom_emoji()函数绘制

p1+geom_emoji(emoji = "1f938")+theme(legend.position = 'none')

p1+geom_emoji(emoji = "1f48e")+theme(legend.position = 'none')

p1+geom_emoji(emoji = "1f697")+theme(legend.position = 'none')


ggbernie包

1、安装并加载ggbernie包

remotes::install_github("R-CoderDotCom/ggbernie")library(ggbernie)

2、绘图——基于ggbernie包中的geom_bernie()函数绘制

p1+geom_bernie(bernie = "sitting")+theme(legend.position = 'none')


p1+geom_bernie(bernie = "stand")+theme(legend.position = 'none')

p1+geom_bernie(bernie = "head")+theme(legend.position = 'none')

p1+geom_bernie(bernie = "young")+theme(legend.position = 'none')

p1+geom_bernie(bernie = "arms")+theme(legend.position = 'none')

p1+geom_bernie(bernie = "eyebrows")+theme(legend.position = 'none')

p1+geom_bernie(bernie = "asking")+theme(legend.position = 'none')


ggcats包

1、安装并加载ggcats包

remotes::install_github("R-CoderDotCom/ggcats@main")library(ggcats)

2、绘图——基于ggcats包中的geom_cat()函数绘制

a<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+ geom_cat(cat = "shironeko", size = 2)+ theme_bw()b<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+ geom_cat(cat = "bongo", size = 2)+ theme_bw()c<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+ geom_cat(cat = "pop", size = 2)+ theme_bw()d<-ggplot(iris,aes(Sepal.Length,Sepal.Width))+ geom_cat(cat = "toast", size = 2)+ theme_bw()cowplot::plot_grid(a,b,c,d,ncol = 2)

参考:

1)https://r-charts.com/miscellaneous/ggbernie/
2)https://r-charts.com/miscellaneous/geomlime/
3)https://r-charts.com/miscellaneous/ggcats/

爱我请给我好看!

您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存