如何获得更清晰的轴标题

时间:2018-04-23 22:06:42

标签: r plot density-plot

我有这个例子

library(MASS)
x = rnorm(50,0,0.00001)
y = rnorm(50,0,.000005)
den2d = kde2d(x,y)

filled.contour(x = den2d$x, y=den2d$y, z=den2d$z, color = terrain.colors, 
               plot.title = title(main = "",
                                  xlab = "SD's of model 1", ylab = "SD's of model 2", cex.lab=0.8),
               plot.axes = { axis(1, seq(-2e-05, 2e-05, by = 1e-05))
                 axis(2, seq(-5e-06, 1.5e-05, by = 5e-06))  },
               key.title = title(main = "Density"),
               key.axes = axis(4, seq(0, 3e+09, by = 5e+08)))

产生类似这样的东西

https://gyazo.com/17675f1f31cb738ee86cf77546a811bf

正如您在y轴上看到的那样,标题被值覆盖。我想知道这有什么方法吗?我希望我的轴标题在R中尽可能大,因为当我在报表中放置图表时,轴文本的大小非常小,因此需要通过在R中使其更大来进行补偿

1 个答案:

答案 0 :(得分:1)

您可以包含las = 3以将y轴标签平行于轴。

filled.contour(x = den2d$x, y=den2d$y, z=den2d$z, color = terrain.colors, 
           plot.title = title(main = "",
                              xlab = "SD's of model 1", ylab = "SD's of model 2", cex.lab=0.8),
           plot.axes = { axis(1, seq(-2e-05, 2e-05, by = 1e-05))
             axis(2, seq(-5e-06, 1.5e-05, by = 5e-06))  },
           key.title = title(main = "Density"),
           key.axes = axis(4, seq(0, 3e+09, by = 5e+08)), 
           las=3)