R绘制玫瑰图,我有玫瑰,你要代码么?

更新什么的,都是浮云

先直接上图

其实就是x轴极化的柱状图,bar长和颜色也是连续变量,label color表示基因类型是离散变量

上数据:

上代码:

ggplot(genes_55_auc)+
  geom_bar(stat = "identity",aes(x=reorder(node_name, glm_OR),y=glm_OR,fill=glm_OR))+
  geom_hline(yintercept =c(1, 2 ),linetype=2,size=.25)+
  annotate("text",x= 0, y=0.7,label="1", hjust = -0.5)+
  annotate("text",x= 0, y=1.7,label="2", hjust = -0.5)+
  # annotate("text",x= 0, y=0,label="OR", hjust = 0.5, vjust = 1.1)+
  scale_fill_gradientn( colours = c(colorRampPalette(c("#edf8b1", "#31a354"))(length(which(genes_55_auc$AUC <0.7))),colorRampPalette(c("#fdae6b", "red"))(length(which(genes_55_auc$AUC >=0.7))+1)[-1] ) )+
  geom_text(aes(x=node_name, y=glm_OR+0.2, label=node_name, 
                size= c(((glm_OR-min(glm_OR))/(max(glm_OR)-min(glm_OR))*1.5)),
                angle= c(seq(90-360/55/2,0,by =-360/55),seq(1.63, -180, by = -360/55)[-1],c(seq(184.9+360/55/2, 90, by = -360/55)[c(-1,-15)],91) )
                ),hjust =0,
            color = genes_55_auc$protein_type, fontface = "bold", 
            family="Times")+
  coord_polar(start=0)+
  theme(axis.text.y = element_blank(),
        axis.text.x = element_blank(),
        axis.ticks = element_blank(),
        axis.title = element_blank(),
        panel.border = element_blank(),
        panel.background = element_rect(fill = "white", colour = NA), 
        panel.grid = element_blank(),
        panel.grid.minor = element_blank()
        )+
  guides(fill=FALSE,size =FALSE, color=FALSE)

你可能感兴趣的:(R绘制玫瑰图,我有玫瑰,你要代码么?)