Hi

tom soyer wrote:
> Hi,
> 
> Is it possible to diagonally fill a rectangle with a color gradient? I
> noticed that the gradient.rect of plotrix could fill a rect either up and
> down or from side to side. I am looking for something similar but fills
> diagonally instead, e.g., from the upper left corner to the bottom right.
> Does anyone know how to do it in R?


Do you mean something like this ... ?

library(grid)
pushViewport(viewport(width=.5, height=.5, clip="on"))
pushViewport(viewport(width=2, height=2, angle=45))
grid.rect(y=100:1/100, just="top",
          gp=gpar(col=NA,
                  fill=colorRampPalette(c("blue", "green"),
                                        space="Lab")(100)))

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
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