[英]R corrplot crops bottom axis label
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. 当我使用corrplot :: corrplot()绘制相关矩阵时,y轴上的底部标签(1)是半截断的,因为绘图的底部位于绘图区域的最底部,并且1以底部轴为中心。 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? 如何在底部留出更多空间,以便不切断此底部y轴标签? 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: 这是一个corrplot,其中颜色标度上的底部标签被切断:
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. 我们可以通过使用corrplot
mar
参数增加边距大小来解决这个corrplot
,以便在图形周围为标签提供足够的空间。 We also need to specify par(xpd=TRUE)
to allow labels to be printed within the margin areas. 我们还需要指定par(xpd=TRUE)
以允许在边距区域内打印标签。 Note that the behaviour of corrplot
with respect to graphical parameters is somewhat inconsistent. 请注意, corrplot
相对于图形参数的行为有些不一致。 Some parameters need to be specified in a par
statement preceding corrplot, otherwise they are not respected if specified within the corrplot statement itself. 某些参数需要在corrplot之前的par
语句中指定,否则如果在corrplot语句本身中指定,则不会遵守这些参数。 Other parameters only work if they are specified within the corrplot statement. 其他参数仅在corrplot语句中指定时才有效。 ?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. 如果未在corrplot
指定, ?corrplot
将告诉您哪些图形参数被默认值corrplot
- 这些是必须在corrplot内指定的。
par(xpd=TRUE)
corrplot(M, mar = c(2, 0, 1, 0))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.