The reason why I ask this question is that I found the lwd parameter is in par() function reference but not in geom_boxplot() function. We all know that the parameters in par() function is for R basic graphics, while geom_boxplot() is a ggplot2 function. But when I add a code lwd=1.5 in the geom_boxplot(), the line width change 1.5 times than the default (just like the description in par() ). For example:
p <- ggplot(mpg, aes(class, hwy))
p + geom_boxplot(lwd=1.5)
It get a plot with thicker lines:
But when I use par(lwd=1.5) and just use geom_boxplot(), nothing changed to that ggplot:
par(lwd = 1.5)
p <- ggplot(mpg, aes(class, hwy))
p + geom_boxplot()
So I have two questions:
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.
But I wouldn’t use those, they’re undocumented and future versions of ‘ggplot2’ might stop accepting them (admittedly unlikely). Furthermore, the aliases don’t really make sense: geom_point(lwd = 5) works, even though a point obviously has no “line width”, so the parameter name is misleading.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With