[R] changing font size in plot(effect())

John Fox jfox at mcmaster.ca
Fri May 26 10:21:45 CEST 2006


Dear Peter,

Won't that wipe out the other components of axis.text, etc.?

Regards,
 John

On Thu, 25 May 2006 06:22:22 -0600
 P Ehlers <ehlers at math.ucalgary.ca> wrote:
> 
> John Fox wrote:
> 
> > Dear Emilie,
> > 
> > This is, I guess, the effect() function in the effects package. If
> so,
> > note that the plot.effect() method uses trellis graphics (via the
> > lattice package), not standard R graphics, so you have to control
> > aspects of the plot in a manner consistent with trellis graphics.
> > 
> > Unfortunately, you can't just specify the scales argument when you
> call
> > plot(), since plot.effect() already includes a scales argument when
> it
> > calls xyplot(). You can, however, set trellis parameters globally,
> > e.g., via something like
> > 
> > axis.text <- trellis.par.get("axis.text")
> > par.ylab.text <- trellis.par.get("par.ylab.text")
> > par.xlab.text <- trellis.par.get("par.xlab.text")
> > axis.text$cex <- 1.5
> > par.ylab.text$cex <- 1.5
> > par.xlab.text$cex <- 1.5
> > trellis.par.set("axis.text", axis.text)
> > trellis.par.set("par.ylab.text", par.ylab.text)
> > trellis.par.set("par.xlab.text", par.xlab.text)
> > 
> > Perhaps this can be done more efficiently -- I'm far from a trellis
> > whiz -- but the above should work.
> > 
> > More generally, in designing the plot method for effect objects, it
> > wasn't my goal to produce publication-quality plots; for that, I
> > suggest that you build a custom graph using the information
> included in
> > the effect object.
> > 
> > I hope this helps,
> >  John
> 
> Possibly a bit more efficient:
> 
> trellis.par.set(list(axis.text = list(cex = 2),
>                       par.ylab.text = list(cex = 1.5),
>                       par.xlab.text = list(cex = 0.5)))
> 
> Also good to know, Emilie:
> 
>    trellis.par.get()
> 
> to see all the things that can be (re)set. Most are self-explanatory.
> 
>   - Peter Ehlers
> 
> > 
> > On Wed, 24 May 2006 13:24:03 -0400
> >  Emilie Berthiaume <Emilie.Berthiaume at usherbrooke.ca> wrote:
> > 
> >>
> >>I can't seem to be able to change the font size in an effect
> display.
> >> I've
> >>tried the following:
> >>
> >>
> >>>par(cex.lab=4)
> >>>plot(effect ("alti",reg8), ylab="detection probability")
> >>
> >>and
> >>
> >>
> >>>plot(effect ("alti",reg8), ylab="detection probability", cex=4)
> >>
> >>but nothing changes.  Can anyone help me?
> >>thanks.
> >>
> >>


--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/



More information about the R-help mailing list