6

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. I wish to hide/cancel a chunk of selected columns and rows correlation values, so only an inverted 'L' of values are shown.

As an example, see edited image of an example corrplot here:

enter image description here

Thomas
  • 43,637
  • 12
  • 109
  • 140
lyqgoh
  • 61
  • 1
  • 3
  • 1
    Probably the first thing you should learn is how to use Google. Try for example http://stackoverflow.com/questions/19012529/correlation-corrplot-configuration – David Arenburg Apr 22 '14 at 08:08
  • 1
    @DavidArenburg perhaps my question is not very clear, I'm not looking to hide just one side of the values, which is what that link has shown. I've edited my question to include an image of the kind of final output I require. – lyqgoh Apr 23 '14 at 09:50

2 Answers2

2

Set those entries you want blank in the plot to NA in the correlation matrix (or a copy of it) and then set the argument na.label=" " in the call to corrplot.

Joe
  • 8,073
  • 1
  • 52
  • 58
GregRG
  • 21
  • 3
0

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). 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.

Pafnucy
  • 608
  • 1
  • 13
  • 17
  • 1
    I don't think answers the question. For example, following this response would entirely exclude column 6. That means that the plot would not show the correlation between Corr9 and Corr6, which is still needed. – mob Apr 30 '17 at 07:45