[R] help with using grid.polygon()

Ally a.rushworth at stats.gla.ac.uk
Wed Aug 4 15:32:14 CEST 2010


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!

Thanks, Alastair
-- 
View this message in context: http://r.789695.n4.nabble.com/help-with-using-grid-polygon-tp2313439p2313439.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list