A quick tutorial:
The way that plotting works in base R graphics is general thought of as a "pen on paper" model. This means that each function you call draws "on top" of what you've created up to that point. Graphical parameters can either be set beforehand via a call to par
, or passed directly to the plotting function directly (with some caveats). So for example, I would have done this as:
par(cex.axis=2, las=2,mar=c(7,4,4,2)+0.1)
boxplot(Aluminum_Dissolved ~ Site,data = dat,
col="purple",ylab = "Dissolved Aluminum",xlab = "Dissolved Aluminum")
If you wanted custom axes, you would have done something like:
par(cex.axis=2, las=2,mar=c(7,4,4,2)+0.1)
boxplot(Aluminum_Dissolved ~ Site,data = dat,
col="purple",ylab = "Dissolved Aluminum",xlab = "Dissolved Aluminum",axes = FALSE)
axis(...)
Subsequent call (on separate lines) to things like points
or lines
would add points or lines to the graph, respectively.
The caveat with par
is that some parameters can only be set by calling par
directly, not by passing them as named arguments to plotting functions. There is a list of those (which includes mar
) located at ?par
.