为什么没有“mar”参数plot.default得到使用?

时间:2016-10-24 09:45:45

标签: r plot graphics

查看plot.default的帮助文件,特别是关于...的部分,我希望提供参数mar=c(1,1,1,1)会导致它被用于当前的情节。有没有办法为这样的当前情节设置边距,在帮助系统中我应该在哪里回答这个问题呢?

考虑一下这个例子:

#R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
#Copyright (C) 2016 The R Foundation for Statistical Computing
#Platform: i386-w64-mingw32/i386 (32-bit)
#...

#Defaults
par("mar")
#[1] 5.1 4.1 4.1 2.1

#Example 1 - plot using default parameters
plot(1)
savePlot("example1.png",type="png")

Example 1 - large margin

#Example 2 - specify parameters as extra arguments
plot(1, mar=c(1,1,1,1))
savePlot("example2.png",type="png")

Example 2 - large margin

#Example 3 - specify margins, then plot
par(mar=c(1,1,1,1))
plot(1)
savePlot("example3.png",type="png")

Example 3 - small margin

我希望示例2生成与示例3相同的输出,但它产生与示例1相同的输出。

1 个答案:

答案 0 :(得分:1)

只能通过调用'par()'来设置几个参数:

.info_content{background-color: red}

• ‘"ask"’, • ‘"fig"’, ‘"fin"’, • ‘"lheight"’, • ‘"mai"’, ‘"mar"’, ‘"mex"’, ‘"mfcol"’, ‘"mfrow"’, ‘"mfg"’, • ‘"new"’, • ‘"oma"’, ‘"omd"’, ‘"omi"’, • ‘"pin"’, ‘"plt"’, ‘"ps"’, ‘"pty"’, • ‘"usr"’, • ‘"xlog"’, ‘"ylog"’, • ‘"ylbias"’ 中的...传递给plot.default内调用的函数;不可能使用像plot.default这样的全局参数。