When I use corrplot::corrplot() to plot a correlation matrix, the bottom label (1) on the y-axis is half cut off, because the bottom of the plot is at the very bottom of the plotting area, and the 1 is centered on the bottom axis. I'd like to use the plot for publication. How do I give a bit more space at the bottom so that this bottom y-axis label is not cut off? Thanks in advance for the plot and for help with the above. This is a very nice plot except for the above issue. Larry Hunsicker
Although no reproducible example was provided, we can show here a generic example of how to deal with this. Here a corrplot, in which the bottom label on the color scale is cut off:
M = cor(mtcars)
corrplot(M)
We can solve this by increasing the margin size using mar
parameter in corrplot
, to give enough space around the figure for labels. We also need to specify par(xpd=TRUE)
to allow labels to be printed within the margin areas. Note that the behaviour of corrplot
with respect to graphical parameters is somewhat inconsistent. Some parameters need to be specified in a par
statement preceding corrplot, otherwise they are not respected if specified within the corrplot statement itself. Other parameters only work if they are specified within the corrplot statement. ?corrplot
will tell you which graphical parameters get over-ridden by default values if not specified in corrplot
- these are the ones that will have to be specified inside corrplot.
par(xpd=TRUE)
corrplot(M, mar = c(2, 0, 1, 0))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With