-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
corrplot with type = "upper" and long colname strings cuts off top labels #10
Comments
The other clunky workaround is |
Changing the size of the graphic device makes the trick: png("file.png")
set.seed(123)
rmat <- matrix(runif(100), ncol = 10)
colnames(rmat) <- c("the quick brown fox jumps over the lazy dog", "and then went to get ice cream", "A", "B", "C", "D", "E", "F", "G", "H")
M <- cor(rmat)
corrplot(M, type = "upper", tl.pos = "td",
method = "circle", tl.cex = 0.5, tl.col = 'black',
order = "hclust", diag = FALSE)
dev.off() png("file2.png", width = 480,height = 600)
set.seed(123)
rmat <- matrix(runif(100), ncol = 10)
colnames(rmat) <- c("the quick brown fox jumps over the lazy dog", "and then went to get ice cream", "A", "B", "C", "D", "E", "F", "G", "H")
M <- cor(rmat)
corrplot(M, type = "upper", tl.pos = "td",
method = "circle", tl.cex = 0.5, tl.col = 'black',
order = "hclust", diag = FALSE)
dev.off() |
Hi, I went through the code of the function to find out a fix. Because, I am here, I added two other propositions...
Hope this can help ! |
Finally, I fixed this issue with the help of code from @statnmap . Your code is quite cryptic, but it seems to work when I added few additional tweaks. Please test it also on Windows. devtools::install_github("vsimko/corrplot") Then, try to generate HTML from |
First, thanks Tiayun and Viliam for the wonderful tool. It is very much needed. I have similar issue as statnmap. I am using windows. The lastest version from CRAN or GitHub won't work. However, statnmap's code work fantastically. Thank you statnmap! |
I don't think the fix has been carried over to corrplot.mixed - latest version off github |
Please re-open this ticket, as this issue exists for corrplot.mixed. |
If you corrplot a correlation matrix where variables in the data have very long names, then the plot cuts off the top labels.
For example, the following code
Produces the following plot:

Removing the tl.cex still has the problem, yielding the following plot:

Note that both plots also have a fairly excessive amount of white space to the left of the plot, but that is not the issue here.
As a workaround, I found that if I comment out line 183 of corrplot.R then the problem is reduced or resolved, although the colorlegend last value (-1) gets cut off the bottom of the plot.
The text was updated successfully, but these errors were encountered: