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

From: P Ehlers <ehlers_at_math.ucalgary.ca>
Date: Fri 26 May 2006 - 23:12:52 EST

No, I don't think so, John. I think what I proposed is Deepayan's newer way of setting parameters. I used to do it the other way, too (S-PLUS may still need it), but I find this new way very handy, since it avoids the get/save/alter/set process.

Try this:

trellis.device()
trellis.par.set(list(axis.text = list(col = "blue"))) # reset colour
trellis.par.get("axis.text")  # inspect
trellis.par.set(list(axis.text = list(cex = 2)))  # reset cex
trellis.par.get("axis.text")  # inspect; colour is still 'blue'

Best wishes,
Peter

John Fox wrote:

> 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@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@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/
> 
> ______________________________________________
> R-help@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

______________________________________________
R-help@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 Received on Fri May 26 23:17:54 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 27 May 2006 - 00:10:19 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.