taiyun / corrplot

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

full_col=TRUE causes color/legend mismatch #157

Closed mkanai closed 3 years ago

mkanai commented 4 years ago

Hi, I found a bug due to a new default argument full_col=TRUE which causes color/legend mismatch.

# CRAN version, v0.84, works
install.packages("corrplot")
library(corrplot)
corrplot(cor(mtcars)/2)
# GitHub version, v0.85, doesn't work
devtools::install_github("taiyun/corrplot")
library(corrplot)
corrplot(cor(mtcars)/2)

I think the correct default behavior is either the following A) or B). Although I found a good use case in #122, I'd like to suggest making full_col=FALSE as a default for backward compatibility. It might be also a good idea to warn users when they set full_col=TRUE but didn't specify cl.lim or is.corr=FALSE.

# A) correct 0-1 color and legend
corrplot(cor(mtcars)/2, full_col=FALSE)
# B) correct full-range color and legend 
corrplot(cor(mtcars)/2, full_col=TRUE, is.corr=FALSE)
taiyun commented 3 years ago

Yes, I have removed full_col just now.

For #122, I will find a better way to solve it.

taiyun commented 3 years ago

Solved now. Please try the latest version on github.

mkanai commented 3 years ago

Great, thank you!

taiyun commented 3 years ago

@mkanai on CRAN now. corrplot v0.88