我们使用R绘制泡泡图时,可能会遇到这样一种情况,即count点太小 ,但又不知道应该如何调大,如下图:
图1 泡泡图附代码:
library(ggplot2)
pathway = read.csv("1KEGG.csv",header=TRUE,row.names=1,check.names = FALSE)
p = ggplot(pathway,aes(Pvalue,pathway))
p=p + geom_point()
p=p + geom_point(aes(size=Count))
pbubble = p+ geom_point(aes(size=Count,color=-1*log10(Pvalue)))
pr = pbubble+scale_color_gradient(low="blue",high = "red")
pr = pr+labs(color=expression(-log[10](Pvalue)),size="Count",
x="-Log10(Pvalue)",y="KEGG pathway",title="KEGG Pathway")
pr + theme_bw()
pr
经学习(向大神请教)后,修改了一下range的大小【+scale_size_continuous(range = c(4.5,7.5))】,如下图:
图2 修改后的泡泡图附代码:
library(ggplot2)
pathway = read.csv("1KEGG.csv",header=TRUE,row.names=1,check.names = FALSE)
p = ggplot(pathway,aes(Pvalue,pathway))
p=p + geom_point()
p=p + geom_point(aes(size=Count))+scale_size_continuous(range = c(4.5,7.5))
pbubble = p+ geom_point(aes(size=Count,color=-1*log10(Pvalue)))+scale_size_continuous(range = c(4.5,7.5))
pr = pbubble+scale_color_gradient(low="blue",high = "red")
pr = pr+labs(color=expression(-log[10](Pvalue)),size="Count",
x="-Log10(Pvalue)",y="KEGG pathway",title="KEGG Pathway")
pr + theme_bw()
pr
问题就这么轻松解决啦,小泡泡变大泡泡,是不是很简单?
网友评论