Closed pbreheny closed 8 years ago
When the by
argument is specified, visreg
uses the lattice
package to display the output, which has a different mechanism for specifying graphical options than base R graphics does. So, for example, suppose we fit the model
airquality$Heat <- cut(airquality$Temp,3,labels=c("Cool","Mild","Hot"))
fit.in1 <- lm(Ozone~ Solar.R + Wind*Heat,data=airquality)
If we try this, nothing happens, as you point out:
visreg(fit.in1, "Wind", by="Heat", cex.axis=2)
The reason is that we are trying to use a base R option with a lattice plot. In lattice, the appearance of the axes is controlled through a scales
argument, so we need:
visreg(fit.in1, "Wind", by="Heat", scales=list(x=list(cex=2)))
or
visreg(fit.in1, "Wind", by="Heat", scales=list(x=list(cex=2), y=list(cex=2)))
For other graphical parameters, you'll have to read the lattice documentation (or try Googling it).
Joaquín Aldabe (Universidad de la República) writes: