Axis labels and legend overlap corrplot with type = "upper" and only NAs in external col/rows #94

Open
Doi90 opened this Issue May 24, 2017 · 0 comments

Comments

Projects
None yet
1 participant

Doi90 commented May 24, 2017

Hello,

I'm trying to make corrplots of type = "upper" and diag = FALSE, but for datasets where I end up with only NA values in the "external" (first/last) rows/columns of the matrix I run in to an issue where the axis labels and legend overlap to plot. The NA values still get plotted, but rows/columns that had only NA values don't get labelled. You could say the plot "zooms in" on the non-NA data.

Is there a way around this problem? I'm running a model comparison over multiple datasets so I need to keep my corrplots the same dimension with some NA values rather than dropping rows/columns to make the figure play nice.

A reproducible example:

library(corrplot)

m <- mtcars
m[1,1] <- m[1,11] <- NA # adding some NAs

corrplot(cor(m), type = "upper")   # plot displays correctly becaue there are
                                   # values in [1,1] & [11,11] from the diagonal

working_corrplot

corrplot(cor(m), type = "upper", diag = FALSE)  # plot displays incorrectly

not_working_plot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment