[R] cloud plot has white(transparent?) background
Deepayan Sarkar
deepayan.sarkar at gmail.com
Tue Apr 22 18:47:48 CEST 2008
On 4/22/08, David Winsemius <dwinsemius at comcast.net> wrote:
> Karin Lagesen <karin.lagesen at medisin.uio.no> wrote in
> news:ypx6prsixgly.fsf at alanine.uio.no:
>
>
> > I am using the code example from the R graph gallery to look at a
> > cloud plot:
> >
> > require(lattice)
> > data(iris)
> > print(cloud(Sepal.Length ~ Petal.Length * Petal.Width, data = iris,
> > groups = Species, screen = list(z = 20, x = -70),
> > perspective = FALSE,
> > key = list(title = "Iris Data", x = .15, y=.85, corner =
> > c(0,1), border = TRUE,
> > points = Rows(trellis.par.get("superpose.symbol"), 1:3),
> > text = list(levels(iris$Species)))))
> >
> > Now, in the example on the webpage this comes out with a nice gray
> > background that makes things easier to see. Mine comes out with a
> > white, potentially transparent background and also the point colors
> > have changed.
> >
> > How do I get the nice gray color back?
>
>
> I think the grey obscures the plot, but with some searching of the help
> files, displaying the rather extensive list from
> trellis.par.get(name = NULL) ... and then finding "Graphical
> Parameters for Trellis Displays", this seems to do what's desired, ...
>
> background <- trellis.par.get("background")
> background$col <- "grey"
> trellis.par.set("background", background)
That is NOT the recommended approach, as it does not change the other
colors, which are designed to go well with a white or light
background, not a grey background. Using standard.theme() gives you a
more coherent collection of parameters.
-Deepayan
More information about the R-help
mailing list