[R] Multiple xyplots

deepayan.sarkar at gmail.com deepayan.sarkar at gmail.com
Wed Sep 5 18:07:31 CEST 2007


On 9/5/07, Tom Wright <tom at maladmin.com> wrote:
> Hi everyone,
> I'm hoping you can give me some pointers. I have a requirement to draw
> multiple (103) xy line plots onto one output device. Ideally the plots
> should be displayed in a hexagonal grid (example at
> www.maladmin.com/example.jpg). I can calculate the locations for each
> waveform but am wondering how to create multiple plotting areas. I have
> come accross references to a package grid (which doesn't seem to be in
> my CRAN mirror probability.ca) and lattice but I'm not sure if I'm on
> the correct lines.
> Any advice gratefully received.

grid seems like the right choice to me (it comes bundled with R, so
it's not available as a separate package). Here's an example that may
give you a few hints:

library(grid)
grid.newpage()
for (i in 1:30)
    grid.lines(x = 0:20/21, y = sin(70 * runif(1) * 0:20/21),
               vp = viewport(x = runif(1), y = runif(1), height =
0.05, width = 0.05))

See the package documentation, or Paul Murrell's book "R Graphics" for more.

-Deepayan



More information about the R-help mailing list