[R] What is the HEX code for "transparent" color?

Roland Rau r@u @end|ng |rom demogr@mpg@de
Fri Jun 7 16:34:12 CEST 2024


On 6/6/24 18:41, Duncan Murdoch wrote:
> On 2024-06-06 4:37 a.m., Yosu Yurramendi wrote:
>> What is the HEX code for "transparent" color?
>> I've tried "00000000" "FFFFFF00" "FFFFFFFF", but they don't work.
> 
> If the other answers don't solve your problem, you should give us some 
> context.  Not all graphics functions in R can handle transparency, so 
> please show us some reproducible code for what you are trying.
> 
> Duncan Murdoch
> 

I usually use the alpha argument of the rgb() function for transparency.
Does this code snippet help to give you an idea how it works.

plot(1, 1, type="n", xlim=c(0,10), ylim=c(0,10))
rect(xleft=0, xright=7.5, ybottom=0, ytop=7.5,
      col=rgb(0, 0, 1, alpha=0.5))
rect(xleft=2.5, xright=10, ybottom=2.5, ytop=10,
      col=rgb(1, 0, 0, alpha=0.5))

Please check
?rgb
Especially the "Details" section should be helpful where you will find a 
list of devices which are supported or not supported.

I hope this helps a bit.

All the best,
Roland


--
This mail has been sent through the MPI for Demographic ...{{dropped:2}}



More information about the R-help mailing list