我问这个问题的原因是我发现lwd
参数在par()
函数引用中,但不在geom_boxplot()
函数中。我们都知道par()
函数中的参数适用于R基本图形,而geom_boxplot()
ggplot2函数适用。但是,当我在中添加代码lwd=1.5
时geom_boxplot()
,行宽更改为默认值的1.5倍(就像中的描述一样par()
)。例如:
p <- ggplot(mpg, aes(class, hwy))
p + geom_boxplot(lwd=1.5)
它得到了一条带有粗线的图:但是,当我使用,par(lwd=1.5)
而仅使用时geom_boxplot()
,该ggplot不变:
par(lwd = 1.5)
p <- ggplot(mpg, aes(class, hwy))
p + geom_boxplot()
par()
?par(lwd = 1.5)
or something similar to this form can not change anything to a ggplot2 picture?‘ggplot2’ doesn’t use the settings from par
. It also doesn’t “inherit” any parameters from base graphics. Some ‘ggplot2’ functions merely accept the base R graphics names as aliases: lwd
works instead of size
, and pch
works instead of shape
.
但是我不会使用它们,因为它们没有记录,并且将来的“ ggplot2”版本可能会停止接受它们(这是不太可能的)。此外,别名没有真正意义:geom_point(lwd = 5)
作品,即使点显然没有“升INE W¯¯我Ð日”,因此参数名称是误导。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句