taiyun / corrplot

A visual exploratory tool on correlation matrix
https://github.com/taiyun/corrplot
Other
316 stars 86 forks source link

Label positions incorrectly computed if there are NAs in cells #96

Closed vsimko closed 3 years ago

vsimko commented 7 years ago
cor(mtcars) -> M
M[1,2:3] <- NA
corrplot(M, diag=FALSE, type="upper")

image

vsimko commented 7 years ago

I think there is some problem while computing the size of the grid. If there are all NA values in a row or column, then the grid is trimmed and the result is a smaller grid which then overlaps with the labels. At the moment, I don't know exactly where this is computed.

taiyun commented 7 years ago

The size of grid is n by n. You can print xy-coordinate on the graph to see the details,

text(1:n, n:1, paste(1:n, n:1, sep='.'))
vsimko commented 7 years ago

I already fixed this image

However, now the following code does not render well (due to na.label = FALSE):

cor(mtcars) -> M
M[1,2:3] <- NA
corrplot(M, diag=FALSE, type="upper", na.label = FALSE)

image