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"),
                                        space="Lab")(200)))

But am only getting a triangle filled with color green, whereas the  
aim is a triangle of color gradient from green to lightgray.

Can grid.polygon() generate a color gradient, or am I being mistaken?

Best to my knowledge, is it true that R currently doesn't contain any  
other function that might generate a polygon with color gradient?

Thank you!

Kexin


        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to