[R] xyplot help - colors and break in plot

Tim Clark mudiver1200 at yahoo.com
Mon Sep 28 23:08:18 CEST 2009


Dear List,

I am new to lattice plots, and am having problems with getting my plot to do what I want.  Specifically:

1. I would like the legend to have the same symbols as the plot.  I tried simpleKey but can't seem to get it to work with autoKey.  Right now my plot has dots (pch=19) and my legend shows circles.

2.  I have nine groups but xyplot seems to only be using seven colors, so two groups have the same color.  How do I get a range of nine colors?

3.  I have one group who's y range is much greater than all the others.  I would like to split the plot somehow so that the bottom part shows ylim=c(0,200) and the top shows ylim=c(450,550).  Is this possible?

What I have so far is:

  library(lattice)
  xyplot(m.dp.area$Area.km2 ~ m.dp.area$DataPoint, m.dp.area, groups = m.dp.area$Manta,
        main = "Cummulative area of 100% MCP",
        xlab = "Data Point",
        ylab = "MCP Area",
        ylim = c(0,150),
        scales = list(tck = c(1, 0)), #Removes tics on top and r-axis
        pch=19,cex=.4,
        auto.key = list(title = "Mantas", x = .05, y=.95, corner = c(0,1),border = TRUE)) #Legend


Thanks,

Tim



Tim Clark
Department of Zoology 
University of Hawaii




More information about the R-help mailing list