Corrplot label printing
Asked Answered
T

1

1

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

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

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

Towandatoward answered 13/5, 2015 at 6:32 Comment(0)
H
2

You can try the following hack:

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

enter image description here

Hagood answered 27/4, 2016 at 15:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.