Corrplot标签打印 [英] Corrplot label printing

查看:115
本文介绍了Corrplot标签打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可以看作是我之前的问题的连续部分- R-corrplot相关矩阵除法-所以我们在这里也使用相同的示例数据.

This can be thought of as a continuum of my earlier question - R - corrplot correlation matrix division - so let's use the same example data here as well.

df <- data.frame(x1 = rnorm(20), x2 = rnorm(20), x3 = rnorm(20),
                 x4 = rnorm(20), x5 = rnorm(20), x6 = rnorm(20),
                 x7 = rnorm(20), x8 = rnorm(20), x9 = rnorm(20),
                 x10 = rnorm(20), x11 = rnorm(20), x12 = rnorm(20))
cormatx <- cor(df)
corrplot(cormatx, method = "color")

现在,我可以通过添加tl.pos = ...来更改标签的位置,根据包装手册,该标签仅将"lt","ld","td","d"或"n"作为参数.它们分别是左和顶部",左和对角线",顶部和对角线",对角线"和"NULL".据我所知,所有涉及对角线"选项的参数甚至都不能用于method = "color".

Now I can alter the position of the labels by adding tl.pos = ..., which, according to the package manual, only takes "lt", "ld", "td", "d" or "n" as arguments. These are "left and top", "left and diagonal", "top and diagonal", "diagonal" and "NULL" respectively. To my knowledge all the arguments involving the "diagonal" option won't even work with method = "color".

是否可以仅打印顶部标签?我尝试了tl.pos = "t",没有任何运气.我认为不支持该参数,因此它返回默认".

Is there a way to print only the top labels? I tried tl.pos = "t", without any luck. I think that argument just isn't supported so it returned "default".

推荐答案

您可以尝试以下技巧:

df <- data.frame(x1 = rnorm(20), x2 = rnorm(20), x3 = rnorm(20),
                 x4 = rnorm(20), x5 = rnorm(20), x6 = rnorm(20),
                 x7 = rnorm(20), x8 = rnorm(20), x9 = rnorm(20),
                 x10 = rnorm(20), x11 = rnorm(20), x12 = rnorm(20))
cormatx <- cor(df)
rownames(cormatx) <- rep(" ", NROW(cormatx)) # hack
corrplot(cormatx, method = "color")

这篇关于Corrplot标签打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆