[R] Coloring spaces between lines in xyplot
Seth W Bigelow
sbigelow at fs.fed.us
Fri Sep 19 20:18:58 CEST 2008
Ok, thanks to Carl Witthoft I now know that to color spaces between and
below a pair of lines in xyplot, I will need to redefine the lines as
polygons, and use the lpolygon panel function, as in the following
library(lattice)
p <- c(1,10,10,1) # vector of x values
q <- c(4,29.2,16,2.5) # vector of y values for upper polygon
r <- c(2.5,16,0,0) # vector of y values for lower
polygon
xyplot(
q + r ~ p,
panel = lpolygon,
col = c("red","green")
)
But, having spent several hours arriving at this increment of knowlege, I
find myself stumped at how to assign different colors to the two polygons!
the above "col" line did not do the job.
--Seth
Dr. Seth W. Bigelow
Biologist, Sierra Nevada Research Center
Pacific Southwest Research Station, USDA Forest Service. 1731 Research Park
Drive, Davis CA 95618
sbigelow at fs.fed.us
www.fs.fed.us/psw/programs/snrc/staff/bigelow
www.swbigelow.net
Phone: 530 759 1718
Fax: 530 747 0241
More information about the R-help
mailing list