[S] Creating shaded polygons

Jean Adams (Jean_Adams@usgs.gov)
Thu, 30 Apr 1998 11:09:17 -0600

I would like to create several figures containing polygons in which
the level of shading used for each polygon's fill is set according to
the value of another variable. But I don't know how to use the range
of shades available for, say, an image() plot in a call to polygon().

Here is a much simplified example of what I want to do, using
different densities of "shading lines" instead of the gray scale (or
whatever color) shades that I would prefer.

reg1 <- list(x=c(1, 4, 3, 1), y=c(1, 4, 5, 5))
reg2 <- list(x=c(1, 3, 3), y=c(1, 1, 3))
reg3 <- list(x=c(3, 5, 5, 3, 4, 3), y=c(1, 1, 5, 5, 4, 3))
val <- c(20, 50, 5)
plot(1:5, 1:5, type="n", axes=F, xlab="", ylab="")
polygon(reg1, density=val[1])
polygon(reg2, density=val[2])
polygon(reg3, density=val[3])

If you have any suggestions, please send them to me and I will
summarize for the group. Thanks for your help.


Jean V. Adams USGS Biological Resources Division
e-mail: jean_adams@usgs.gov Great Lakes Science Center
phone: (734) 214-9307 1451 Green Road
FAX: 734-994-8780 Ann Arbor, MI 48105-2899 USA
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news