Hi,
I don't think the fill parameter can be a colour gradient. You'll need
to create small polygons, each with its own fill (200, say). Try this,
x= c(0, 0.5, 1)
y= c(0.5, 1, 0.5)
grid.polygon(x=x, y=y, gp=gpar(fill=grey90, col=grey90))
xx - seq(range(x)[1],range(x)[2], length=100)
yy -
[I neglected to check some details in the previous post]
This one should work better,
library(grid)
x= c(0, 0.5, 1)
y= c(0.5, 1, 0.5)
grid.polygon(x=x, y=y, gp=gpar(fill=NA, col=grey90)) # outer shell
xx - seq(range(x)[1],range(x)[2], length=100)
dx - diff(xx) # width of clipped triangles
Glad if it helps.
check out this page of examples for tikz,
http://www.texample.net/tikz/examples/feature/shadings/
If you do choose this route, you could perhaps read the new wiki page on
importing graphics in a R plot,
Hi,
I wonder whether there is a way to generate a polygon (a triangle in
my case) with color gradient using grid.polygon() in package grid?
I tried something like
library(grid)
grid.polygon(x=c(0, 0.5, 1), y=c(0.5, 1, 0.5), gp=gpar(col=NA,
fill=colorRampPalette(c(green, lightgray),
4 matches
Mail list logo