Re: [R] cloud plot has white(transparent?) background

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Tue, 22 Apr 2008 14:20:59 +0000 (UTC)

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)

> 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))
+              )))

(I initially tried ...
 trellis.par.set(background$col, "grey") #fails)

-- 
David Winsemius

______________________________________________
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.
Received on Tue 22 Apr 2008 - 14:24:06 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Apr 2008 - 17:30:30 GMT.

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

list of date sections of archive