On Aug 4, 2010, at 9:32 AM, Ally wrote:
Hi,
I'm trying to use grid.polygon() to plot several polygons at once,
with a
view to putting coloured polygons beneath a curve. I'm struggling
just to
get the grid.polygon to plot anything
# PLOT SOME POINTS
x <- 1:100
y <- 1:100*0.5 + 3
plot(x, y, pch = ".")
# PLOT 2 POLYGONS
library(grid)
grid.polygon(x = c(20, 20, 40, 40, 40, 40, 60, 60),
y = c(0, 10, 20 , 0, 0, 20, 30, 0), id = rep(1:2,
each =
4), draw = T)
I'm wondering whether this is to do with the 'id' parameter, if I've
misunderstood it's use - but any hep would be greatly appreciated!
Your x and y locations are so large they are off the page. Compare:
grid.polygon(x = c(20, 20, 40, 40, 40, 40, 60, 60)/100,
y = 0.5+c(0, 10, 20 , 0, 0, 20, 30, 0)/100, id =
rep(1:2, each =
4), draw = T)
David Winsemius, MD
West Hartford, CT
______________________________________________
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.