p <- ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width)) + geom_point(aes(color = Petal.Length, size = Petal.Width, shape = Species)) +scale_color_gradient(low = "#f0cf61", high = "#371722") + scale_size_continuous(range = c(1, 4)) + theme_classic() + labs(...
scale_color_gradient(low = "#f0cf61", high = "#371722") + scale_size_continuous(range = c(1, 4)) + theme_classic() + labs(x = "Sepal Length", y = "Sepal Width", title = "Iris Sepal") + theme(plot.title =element_text(size = 15, face = "bold", hjust = 0.5), axis.t...
scale_size_continuous(range = c(1, 4)) + theme_classic() + labs(x = "Sepal Length", y = "Sepal Width", title = "Iris Sepal") + theme(plot.title = element_text(size = 15, face = "bold", hjust = 0.5), axis.title = element_text(face = "bold"), legend.title = element_t...
即使是气泡图,各个数据间的大小比较并不是很明显,所以需要时使用scale_size_continuous()函数。 1ggplot(data, aes(x=carat, y=price, size=depth)) + 2geom_point(alpha=0.2) + 3scale_size_continuous(range = c(0.5, 15))#控制最大气泡和最小气泡,调节气泡相对大小 1# Note that you can add a t...
ggplot(data=iris,aes(x=Sepal.Length,y=Sepal.Width,color=Petal.Length,size=Petal.Width,shape=Species))+geom_point()+scale_color_gradient(low="#f0cf61",high="#371722")+scale_size_continuous(range=c(1,4))+theme_classic()+labs(x="Sepal Length",y="Sepal Width",title="Iris Sepal")+the...
color=Class,size=pvalue))+ geom_point()+ scale_size_continuous(range = c(1,10)) 1. 2. 3. 4. image.png 气泡图将透明度设置低一点可能会好看一点 ggplot(df,aes(x=ID,y=log2FC, color=Class,size=pvalue))+ geom_point(alpha=0.5)+ ...
对于连续性变量,通常使用函数scale_x_continuous、scale_y_continuous scale_x_continuous( name = waiver(), breaks = waiver(), minor_breaks = waiver(), n.breaks = NULL, labels = waiver(), limits = NULL, expand = waiver(), oob = censor, na.value = NA_real_, trans = 'identity', guide...
scale_colour_gray() scale_colour_hue() scale_colour_brewer() scale_colour_manual() 基于大小属性: scale_size_discrete() scale_size_continuous() scale_size_manual() scale_size_area() 基于形状属性: scale_shape_discrete() scale_shape_continuous() ...
p1 <- ggplot(df, aes(y, x)) + geom_point()+scale_x_continuous(labels = scales::percent,name="percent")p2 <- ggplot(df, aes(y, x)) + geom_point()+scale_x_continuous(labels = scales::dollar,name="dollar")grid.arrange(p1,p2,ncol=2) scales::percent、scales::dollar分别指定x轴...
# 代码来自 http://sape.inf.usi.ch/quick-reference/ggplot2/shaped=data.frame(p=c(0:25,32:127))ggplot() +scale_y_continuous(name="") +scale_x_continuous(name="") +scale_shape_identity() +geom_point(data=d, mapping=aes(x=p%%16, y=p%/%16, shape=p), size=5, fill="red") ...