简体   繁体   English

如何隐藏corrplot的选定相关性?

[英]How to hide selected correlations for corrplot?

I am new to coding and R. I was trying to visualize a correlation matrix using corrplot , but don't want to show all the correlation values. 我是编码和R的新手。我试图使用corrplot可视化相关矩阵,但不想显示所有相关值。 I wish to hide/cancel a chunk of selected columns and rows correlation values, so only an inverted 'L' of values are shown. 我希望隐藏/取消一大块选定的列和行相关值,因此只显示反转的“L”值。

As an example, see edited image of an example corrplot here: 例如,请在此处查看示例corrplot编辑图像:

在此输入图像描述

将图中您想要空白的条目设置为相关矩阵(或其副本)中的NA ,然后在调用na.label=" "设置参数na.label=" "

exclude these columns by using indexes, for example 例如,使用索引排除这些列

M <- cor( mtcars[ , -c(1, 3, 6)] )
corrplot(M, method = "ellipse")

where we exclude columns 1, 3, 6 (variables mpg, disp, cyl). 我们排除第1,3,6列(变量mpg,disp,cyl)。 Other way would be specifying which columns should be evaluated 其他方法是指定应评估哪些列

mtcars[ , c(2:4, 7) ]

takes into account columns 2, 3, 4 and 7. Go through some R tutorial for beginners to familiarize yourself with coding conventions. 考虑第2,3,4和7列。通过一些R教程,让初学者熟悉编码约定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM