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

P Ehlers ehlers at math.ucalgary.ca
Thu May 25 14:22:22 CEST 2006


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.
>>
>>
>>Emilie Berthiaume
>>graduate student
>>Sherbrooke University
>>2500 boul. de l'Université
>>Sherbrooke, Québec
>>J1K 2R1 CANADA
>>
>>Phone: 1-819-821-8000 poste 2059
>>Fax: 1-819-821-8049
>>emilie.berthiaume at USherbrooke.ca
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide!
>>http://www.R-project.org/posting-guide.html
> 
> 
> --------------------------------
> John Fox
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> http://socserv.mcmaster.ca/jfox/
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



More information about the R-help mailing list