【问题标题】:How can I change the transparency of a corrplot in R?如何更改 R 中 corrplot 的透明度?
【发布时间】:2021-03-10 16:18:39
【问题描述】:

我在 R 中工作,我正在使用库 corrplot

我想更改corrplot 的透明度,类似于控制ggplot 中的alpha 参数。

我正在使用的代码示例是:

x <- rnorm(100,0,1)
y <- rnorm(100,0,1)
z <- rnorm(100,0,1)
cor0 <- cor(cbind(x,y,z))
corrplot::corrplot(cor0, "square")

知道如何实现吗?

【问题讨论】:

    标签: r r-corrplot


    【解决方案1】:

    一种可能性是使用scales::alpha 自己设置颜色及其透明度:

    library(scales)
    
    colors <- scales::alpha(colorRampPalette(c("white", "red"))(10), alpha = 0.3)
    
    corrplot::corrplot(cor0, "square", col = colors)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-04
      • 1970-01-01
      • 1970-01-01
      • 2011-01-22
      • 1970-01-01
      • 2011-07-04
      • 2015-06-12
      • 1970-01-01
      相关资源
      最近更新 更多