The graphics device is what takes the plotting commands and turns them into
something visual. If you don't specify a device then a default one is started
when you do your first plot. The default for linux is an X11 device and the
default for Windows is a Windows graphics device. Unfortunately, neither of
those devices has implemented alpha channels yet and that is why you are not
seeing the effect.
You have a couple of different options:
1. I believe the default device on Mac does do alpha channels, so you could
find a Mac to work on.
2. The pdf device has implemented alpha channels, so you can do something like:
> pdf('myplot.pdf',version='1.4')
> plot(1,col = rgb(0,0,255, alpha=254,
+ maxColorValue=255))
> dev.off()
Then open the file myplot.pdf to look at the plot.
3. The cairoDevice package implements another graphics device that implements
alpha channels (I have used it on Windows, I think it also works on linux, but
I have not tried it there). Download and install the cairoDevice package then
do:
> Cairo() # an extra window will pop-up where the graphs will be plotted
> plot(1,col = rgb(0,0,255, alpha=254,
+ maxColorValue=255))
This last option is my prefered as it is the most similar to using the default
devices and you can see the graph as it is being costructed rather than having
to do all the graphing, then open an external file.
Hope this helps,
________________________________
From: Jun Ding [mailto:[EMAIL PROTECTED]
Sent: Wed 3/7/2007 11:00 PM
To: Greg Snow; [email protected]
Subject: RE: [R] alpha parameter in function rgb to specify color
Hi Greg,
I am not sure if I understand you correctly.
I am using the "plot" command directly in R Console in
the windows version of R and I also have tried it in
the linux version of R.
Thanks a lot for your help!
Best,
Jun
--- Greg Snow <[EMAIL PROTECTED]> wrote:
> Which graphics device are you using?
>
> ________________________________
>
> From: [EMAIL PROTECTED] on behalf of
> Jun Ding
> Sent: Wed 3/7/2007 9:47 PM
> To: [email protected]
> Subject: [R] alpha parameter in function rgb to
> specify color
>
>
>
> Hi All,
>
> In function "rgb", alpha parameter is supposed to
> set
> the transparency value. But in my following two
> examples, it didn't work:
>
> plot(1,col = rgb(1,0,0,alpha =0.8))
> # as long as alpha < 1, there is no point in the
> plot.
>
> plot(1,col = rgb(0,0,255, alpha=254,
> maxColorValue=255))
> # as long as alpha < 255, there is no point in the
> plot.
>
> Do I use it in the right way? Any advice is
> appreciated.
>
> Best,
>
> Jun Ding
>
>
>
>
____________________________________________________________________________________
> Expecting? Get great news right away with email
> Auto-Check.
>
> ______________________________________________
> [email protected] 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.
>
>
>
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.