[R] Using sunflowerplot to add points in a xyplot panel

Dieter Menne dieter.menne at menne-biomed.de
Tue Aug 14 16:52:14 CEST 2007

Ronaldo Reis Junior <chrysopa <at> gmail.com> writes:

> Hi,
> I use panel.points to add points to a xyplot graphic. But I like to use the 
> sunflowerplot to plot my points because this is very superimposed. It is 
> possible to use this? I try but it dont work directly. It may be need to put 
> this function inside a panel.??? 

sunflower is "old style R graphics", and xyplot is lattice/trellis. these two
normally don't get along together too well. Paul Murrell's grid which is the
base of lattice, can do some magic to bring them together.


## Modfied after Cris Bergstresser and Paul Murrell

sunpanel <- function(x, y, subscripts, ...) {
  pushViewport(viewport(x = 0.5, y = 0.5, just = "center"));
  sunflowerplot(x, y, axes = FALSE, xlab = "", ylab = "");

x = round(runif(100, 1, 5));
y = round(runif(100, 1, 5));
print(xyplot(y ~ x, aspect = "iso", panel = sunpanel));

More information about the R-help mailing list