r - 在 R 中制作相关值的矩形矩阵,可能使用 corrplot
问题描述
我想在 R 中制作一个相关值矩阵。但是,我没有将参数与它们自己进行比较,所以它不是典型的 corrplot 是一个三角形并镜像在对角轴上。我实际上已经有了相关值。
我只是希望招募该corrplot
功能(来自corrplot 包),该功能会产生如下图像:
我的数据,已经包含我想要绘制的相关值,是:
X animal.1 animal.2 animal.3 animal.4 animal.5
1 parameter 1 0.10258087 0.3338782 0.150246554 0.07295133 0.2484152
2 parameter 2 0.04205748 0.4062727 -0.002101464 0.12068818 0.2951127
3 parameter 3 0.11264488 0.4114954 0.067145776 0.13361071 0.3246052
4 parameter 4 -0.02261649 -0.2426341 0.108042167 -0.12820517 -0.2005686
5 parameter 5 -0.01576384 -0.2300852 0.112941655 -0.12391976 -0.1906473
6 parameter 6 -0.09749030 -0.3110920 0.021994297 -0.13570257 -0.2557532
我希望情节看起来像一个 corrplot,但它将是一个完整的矩形。我想要不同直径的圆圈,正值或负值的两种不同颜色,以及沿图边的颜色渐变。本质上,我想要一个矩形值表的 corrplot 主题。
我还要求查看是否可以在具有显着 (p<0.05) p 值的网格方块上放置星号。我现在附上 p 值矩阵的 dput 文件
structure(list(X = structure(1:6, .Label = c("parameter 1", "parameter 2",
"parameter 3", "parameter 4", "parameter 5", "parameter 6"), class = "factor"),
Animal.1 = c(0.2454906, 0.63471, 0.2019519, 0.7984066, 0.8587147,
0.2698293), Animal.2 = c(0.000103586, 1.62e-06, 1.15e-06,
0.005412082, 0.008451775, 0.000315107), Animal.3 = c(0.08796553,
0.9810688, 0.447827, 0.2211191, 0.2007585, 0.8038392), Animal.4 = c(0.4094627,
0.1713835, 0.1296492, 0.1460429, 0.1601174, 0.1236984), Animal.5 = c(0.004374306,
0.000653099, 0.00016464, 0.02213469, 0.0298038, 0.003315349
)), .Names = c("X", "animal.1", "animal.2", "animal.3", "animal.4",
"animal.5"), class = "data.frame", row.names = c(NA, -6L))
解决方案
推荐阅读
- .net - .NET dll 在 MATLAB 中调用
- python - np.random.rand Python 的等效代码
- android - onBindViewHolder 只执行第一个 ViewHolder
- c - 程序编译,但收到不正确的答案 - C 中的辛普森规则集成
- cassandra - Cassandra 的 JMX 指标 TombstoneScannedHistogram RecentValues 是什么意思?
- react-native - 使用 DefaultTask 设置 gradle 插件以实例化呈现 react-native 的类
- r - R:将行转换为列并将值分配给相应的列
- node.js - 如何处理 node.js 上没有返回数据的 sqlite3
- java - 如何通过索引选择随机元素?
- python - 传递参数和范围的问题,我该如何解决?