An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20131211/d99c87b7/attachment.pl>
setting effect plot parameters
2 messages · otoolem, John Fox
Dear Malcolm,
You can't specify some trellis arguments to plot.eff() because some of them,
such as scales, will conflict with trellis arguments that are already set by
plot.eff(), the plot() method for objects of class "eff" produced by
effect(). Likewise arguments that you specify via trellis.par.set() may be
overridden by plot.eff().
You should be able to do some of what you want by specifying arguments such
as ticks.x to plot.eff() -- see ?plot.eff. Also, plot.eff() returns an
object that inherits from "trellis" and consequently you should be able to
manipulate it with the update() method for "trellis" objects. For example,
library(effects)
mod <- lm(prestige ~ type*(income + education), data=Prestige)
(eff <- effect("type*income", mod))
(p <- plot(eff))
update(p, scales=list(x=list(at=seq(10000, 20000, 5000),
labels=seq(10000, 20000, 5000))))
Finally the object returned by effect() has a reasonably simple structure
and you should be able to construct a customized plot by using the
information in the object, e.g., with xyplot().
I hope that this helps,
John
-------------------------------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of otoolem Sent: December-10-13 11:25 PM To: r-help at r-project.org Subject: [R] setting effect plot parameters I have tried to set parameters of an effects plot with moderate success,
but
I'm finding that although the plot(effect()) method uses trellis graphics
(via
the lattice package), not all aspects of the plot can be controlled by
standard
trellis graphics.
I am able to set any parameters that are given in trellis.par.get() easily
enough, for example:
axis.components <- trellis.par.get("axis.components")
axis.components$right$tck <- 0 axis.components$top$tck <- 0
axis.components$left$pad1 <- 2 axis.components$left$pad2 <- 2
trellis.par.set("axis.components", axis.components) but I have been unable
to change other axis parameters such as setting the number of ticks on the
bottom and left axes. I can do this in a conventional lattice plot such as
xyplot
xyplot(lar~mdep, data=m1, scales=list( x=list(tck=c(1,0), at=seq(100,max(m1$mdep),100)), y=list(tck=c(1,0), at=seq(0,max(m1$lar)+0.1,0.05)))) but this does not work for effects plots. Any help would be much appreciated. [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code.
--- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com