如何更改 R 中 corrplot 的透明度?

How can I change the transparency of a corrplot in R?

我在 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")

知道如何实现吗?

一种可能是使用 scales::alpha:

自行设置颜色及其透明度
library(scales)

colors <- scales::alpha(colorRampPalette(c("white", "red"))(10), alpha = 0.3)

corrplot::corrplot(cor0, "square", col = colors)