我想在图表中使用较大的字体大小绘制数据.
x = c(0:10)
y = sin(x) + 10
plot (
x, y, type="o",
xlab = "X values",
ylab = "Y values",
cex.axis = "2",
cex.lab = "2",
las = 1
)
Run Code Online (Sandbox Code Playgroud)
不幸的是,y轴上的数字与y轴的标签重叠.我试图使用mar,但是这不起作用(顺便说一下,我怎样才能找出哪些图形参数可以直接用在plot命令中,哪些必须用par() - 方法设置?).
如何避免标签重叠?
谢谢你的帮助.
斯文
Ric*_*ton 18
使用par(mar)增加的情节利润率和par(mgp)移动轴标签.
par(mar = c(6.5, 6.5, 0.5, 0.5), mgp = c(5, 1, 0))
#Then call plot as before
Run Code Online (Sandbox Code Playgroud)
在帮助页面中,?par它解释了哪些参数可以直接使用,哪些参数plot必须通过调用par.
有几个参数只能通过调用'par()'来设置:
Run Code Online (Sandbox Code Playgroud)• ‘"ask"’, • ‘"fig"’, ‘"fin"’, • ‘"lheight"’, • ‘"mai"’, ‘"mar"’, ‘"mex"’, ‘"mfcol"’, ‘"mfrow"’, ‘"mfg"’, • ‘"new"’, • ‘"oma"’, ‘"omd"’, ‘"omi"’, • ‘"pin"’, ‘"plt"’, ‘"ps"’, ‘"pty"’, • ‘"usr"’, • ‘"xlog"’, ‘"ylog"’ The remaining parameters can also be set as arguments (often via ‘...’) to high-level plot functions such as ‘plot.default’, ‘plot.window’, ‘points’, ‘lines’, ‘abline’, ‘axis’, ‘title’, ‘text’, ‘mtext’, ‘segments’, ‘symbols’, ‘arrows’, ‘polygon’, ‘rect’, ‘box’, ‘contour’, ‘filled.contour’ and ‘image’. Such settings will be active during the execution of the function, only. However, see the comments on ‘bg’ and ‘cex’, which may be taken as _arguments_ to certain plot functions rather than as graphical parameters.