[R] How can I create transparant colour
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Dec 4 13:56:26 CET 2008
Well, if it is transparent then you will not see it: I presume you mean
translucent (aka semi-transparent). With 50% opacity you could use
red <- rgb(0x9E, 0x47, 0x70, 127, max=255)
polygon(xvalue1,yvalue1,col=red,border=red)
See ?rgb.
You can also specify a translucent colour as e.g. "#9E47707F", but that
seems less intuitive.
On Thu, 4 Dec 2008, Dr. Alireza Zolfaghari wrote:
> Hi list,
> Does any one know how I can make the red colour transparant?
>
> #########################
> par()
> #Set up blank plot to remove plot border type lty="n"
> xvalue1<- c(1,2,2,1)
> xvalue2<- c(1,3,3,1)
> yvalue1<- c(0,0,22,22)
> yvalue2<- c(0,0,44,44)
> plot(c(min(xvalue2),max(xvalue2)),c(min(yvalue2),max(yvalue2)),type="n",xaxt="n",yaxt="n",xlab="",ylab="Loss
> in ?m",yaxs="i",xaxs="r")
> polygon(xvalue2,yvalue2,col="#A8B50A",border="#A8B50A")
> polygon(xvalue1,yvalue1,col="#9E4770",border="#9E4770")
> #########################
>
> regards,
> Alireza
>
> [[alternative HTML version deleted]]
>
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list