可以通过设置参数col参数来自定义legend bar Palette。col参数可以接受以下值:

  • "gray": 灰度色阶
  • "RdYlBu": 红黄蓝色阶
  • "RdYlGn": 红黄绿色阶
  • "YlOrRd": 黄橙红色阶
  • "BuPu": 蓝紫色阶
  • "GnBu": 绿蓝色阶
  • "YlGnBu": 黄绿蓝色阶
  • "YlGn": 黄绿色阶
  • "Blues": 蓝色阶
  • "Greens": 绿色阶
  • "Reds": 红色阶
  • "Purples": 紫色阶
  • "Oranges": 橙色阶

例如,要使用红黄蓝色阶作为legend bar Palette,可以使用下面的代码:

library(corrplot)

# 创建一个样本数据集
set.seed(123)
data <- matrix(rnorm(100), ncol = 10)

# 使用corrplot函数画相关性热图,并设置col参数为RdYlBu
corrplot(cor(data), method = "color", col = "RdYlBu")

运行上述代码将会生成一个使用红黄蓝色阶作为legend bar Palette的相关性热图

corrplot包里用corrplot函数画相关性热图自定义legend bar Palette

原文地址: https://www.cveoy.top/t/topic/fsGr 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录