geom_vline(xintercept = c(-1.2,1.2), linetype = "dashed", color = "black")+ geom_point(aes(size = -log10(adj.P.Val), color = -log10(adj.P.Val)))+ scale_color_gradientn(values = seq(0,1,0.2), colors = c("#39489f","#39bbec","#f9ed36","#f38466","#b81f25"))+s...
ggplot2::scale_colour_gradientn( colours = nbalogo_palette(name = name,direction = direction, n = 256, type = "continuous"),... ) } scale_color_nbalogo_c <- scale_colour_nbalogo_c scale_fill_nbalogo_d <- function(name, direction = 1, ...) { if (!requireNamespace("ggplot2",...
5.2我们为图像配色 scale_colour_gradientn(colours=c("darkblue","blue","#0092FF","#00FF92","#49FF00","#FFDB00","#FF0000","red","darkred"))+ 得到下面的图像: 5.3为图像加上线性回归和对角线 geom_smooth(method = "lm",formula = y~x,color="black")+ geom_abline(slope = 200,inter...
mid = "white", high = "blue") #使用R预设调色板 p + scale_color_gradientn(colours =rainbow(...
colour_gradientn中使用。因此,只需选择生成颜色的方式与我在上一篇文章中给出的答案相同,并在scale_...
scale_color_gradientn创建n色渐变 双色渐变 aaa=mpgaaa$cty<- aaa$cty-20f <- ggplot(aaa, aes(cty, hwy))+ geom_point(aes(color=cty))f + scale_colour_gradient(low = "green", high = "red")低-中-高三色渐变 f + scale_color_gradient2(low = "green", mid = "black", high n色渐变...
ggplot2::scale_colour_gradientn( colours = nbalogo_palette(name = name,direction = direction, n = 256, type = "continuous"),... ) } scale_color_nbalogo_c <- scale_colour_nbalogo_c scale_fill_nbalogo_d <- function(name, direction = 1, ...) { ...
color = "black", size = 3.5) + xlab(sprintf("PC1 (%.1f%%)", PC1_varEx)) + ylab(sprintf("PC2 (%.1f%%)", PC2_varEx)) + scale_colour_gradientn(colours = rev(pal), breaks = seq(from = 5, to = 25, by = 5)) +
color = "black", size = 3.5) + xlab(sprintf("PC1 (%.1f%%)", PC1_varEx)) + ylab(sprintf("PC2 (%.1f%%)", PC2_varEx)) + scale_colour_gradientn(colours = rev(pal), breaks = seq(from = 5, to = 25, by = 5)) +
如果你希望使用连续型变量,ggsci包更为实用。通过scale_color_lancet()或scale_color_jama()等函数,你可以为连续变量设置颜色。例如,pal_npg("nrc")(10)可以展示其内置的颜色方案,而scale_fill_gradientn()则能帮助你创建渐变色,如使用"Blues"方案填充连续变量的值。除了这些包,你还可以直接在...