论文
Somatic variations led to the selection of acidic and acidless orange cultivars
https://www.nature.com/articles/s41477-021-00941-x
柑橘体细胞变异2021NP.pdf
今天的推文我们来复现一下论文中的Figure4a
image.png
里面的饼图是三类转座子的一个比例,外面一圈是再进一步分类的转座子的比例
这个用R包ggforce里面的geom_arc_bar()
函数很容易实现
首先是构造作图数据
代码语言:javascript复制library(ggforce)
dat01<-data.frame(x=c("A","B","D"),
y=c(52.3,38.5,9.2))
dat02<-data.frame(x=c('a','b','c','d','e','f','g','h','i'),
y=c(26.7,22.9,2.7,30.5,3.9,2,2.1,8.3,0.9))
作图代码
代码语言:javascript复制ggplot()
geom_arc_bar(data=dat01,
stat="pie",
aes(x0=0,y0=0,r0=0,r=2,
amount=y,fill=x),
show.legend = FALSE,
linewidth=2)
theme_bw()
theme(panel.grid = element_blank(),
panel.border = element_blank(),
axis.title = element_blank(),
axis.text = element_blank(),
axis.ticks = element_blank())
coord_equal()
scale_fill_manual(values = c("white","white","white"))
annotate(geom = "text",x=1,y=0,label="LTRn52.3%",size=5)
annotate(geom = "text",x=-1,y=0,label="DNAn38.5%",size=5)
annotate(geom = "text",x=-0.5,y=1.5,label="LINE andnSINE",size=5)
ggnewscale::new_scale_fill()
geom_arc_bar(data=dat02,
stat="pie",
aes(x0=0,y0=0,r0=2.1,r=3.1,
amount=y,fill=x),
show.legend = FALSE,
linewidth=0.5)
annotate(geom = "text",x=1.8,y=1.9,label="Gypsyn26.7%",size=5)
annotate(geom = "text",x=1.6,y=-1.9,label="Copian22.9%",size=5)
annotate(geom = "text",x=-0.15,y=-2.5,label="LTRnothersn1.7%",size=3)
annotate(geom = "text",x=-2.4,y=-1,label="MuLEn30.5%",size=5)
annotate(geom = "text",x=-2.1,y=1.5,label="hATn3.9%",size=5)
annotate(geom = "text",x=-2.6,y=2.3,label="CMC-EnSpmn2.0%",size=5)
annotate(geom = "text",x=-2.3,y=2.7,label="DNA othersn2.1%",size=5)
annotate(geom = "text",x=-0.8,y=2.5,label="Linen8.3%",size=5)
annotate(geom = "text",x=0,y=3.3,label="SINE 9%",size=5)
scale_fill_manual(values = c("#ffe699","#c6deb5","#c7c7c7","#ff9999",
"#99ffff","#f8cbad","#c6acd9","#99dff9","#ffc2ff"))
image.png
geom_arc_bar()
函数里 x0 y0 是圆心的位置r是圆的半径r0是中间空出来的圆的半径,即使有很多圈,也可以通过这种方式继续叠加
image.png
欢迎大家关注我的公众号
小明的数据分析笔记本
小明的数据分析笔记本 公众号 主要分享:1、R语言和python做数据分析和数据可视化的简单小例子;2、园艺植物相关转录组学、基因组学、群体遗传学文献阅读笔记;3、生物信息学入门学习资料及自己的学习笔记!