2009/9/29 Tim Clark <mudiver1...@yahoo.com>: > 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.
Rather than the pch = 19 argument, use par.settings = simpleTheme(pch = 19, cex = .4) > > 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? Yes, in the default theme, there are seven colours: see trellis.par.get("superpose.symbol") You can change the set of colours yourself by modifying that list (via trellis.par.set). An easier option is to use one of the predefined ColorBrewer palettes, with custom.theme() from the latticeExtra package, or just simpleTheme(). See ?brewer.pal (RColorBrewer package) You will see there are a few qualitative color palettes with 9 or more colours: e.g. brewer.pal(9, "Set1") brewer.pal(12, "Set3") > > 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? Yes... in the absence of a reproducible example, maybe something like xyplot(Area.km2 ~ DataPoint | (Area.km2 > 200), m.dp.area, groups = Manta, scales = list(y = "free")) or AreaRange <- shingle(Area.km2, rbind(c(0,200),c(450,550))) xyplot(Area.km2 ~ DataPoint | AreaRange, m.dp.area, groups = Manta, scales = list(y = "free")) > > 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 > > ______________________________________________ > R-help@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. > -- Felix Andrews / 安福立 Postdoctoral Fellow Integrated Catchment Assessment and Management (iCAM) Centre Fenner School of Environment and Society [Bldg 48a] The Australian National University Canberra ACT 0200 Australia M: +61 410 400 963 T: + 61 2 6125 1670 E: felix.andr...@anu.edu.au CRICOS Provider No. 00120C -- http://www.neurofractal.org/felix/ ______________________________________________ R-help@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.