As Duncan suggested, this will probably get you what you want.

You can set the transparency using alpha.f in adjustcolor().

x <- c(1:5)
color <- c(2,2,3,4,5)
color_transparent <- adjustcolor(color, alpha.f = 0.3)

plot(x, col = color, pch = 20, cex = 4)
plot(x, col = color_transparent, pch = 20, cex = 4)

?adjustcolor

Richard



On Wed, Dec 18, 2013 at 2:35 PM, Christoph Scherber <csche...@gwdg.de>wrote:

> you will need to specify colours as RGB values and then set transparency
> via the "alpha" argument.
>
> e.g.: color=rgb(0,0,0,alpha=0.3)
>
> # will  give black (0,0,0) and a transparency of 30%.
>
> Best wishes
> Christoph
>
>
>
> On 18/12/2013 23:23, capricy gao wrote:
>
>> I checked as you suggested. However, I found that the number in those
>> functions are the number of colors. In contrast, my number here means a
>> specific color, for example, 2 in my code means "red", 3 in my code means
>> "green"....
>>
>>
>>
>>
>>
>> On Wednesday, December 18, 2013 1:18 PM, Duncan Murdoch <
>> murdoch.dun...@gmail.com> wrote:
>>   On 13-12-18 2:08 PM, capricy gao wrote:
>>
>>  I found all the color transparency was defined with character color, or
>>> rgb color. What if I have number code and still try to modify the
>>> transparency?
>>>
>>> For example:
>>>
>>>  x=c(1:5)
>>>> color=c(2,2,3,4,5)
>>>> plot(x, col=color)
>>>> plot(x, col=color,pch=20)
>>>>
>>> here I defined color by numbers, how can I modify the transparency?
>>>
>> See the examples for ?palette.
>>
>> Duncan Murdoch
>>         [[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.
>>
>
> ______________________________________________
> 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.
>

        [[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