Rgb () with ggplot2 in R

In ggplot2 we can set colors by name or hex code. Is there a way to use rgb values ​​in the same way? I was looking for documents, but the quick answer seems no. (The reason I would like to use rgb is because I have some colors that I am going to use for some graphs, and I have all of them in rgb format. I can get the hex from places like here but it would be great if I could just enter the values ​​directly in ggplot() .

+7
r rgb ggplot2
source share
1 answer

You can use the rgb function to convert fractional RGB values ​​to hex.

 rgb(0.1,0.2,0.3) [1] "#1A334D" 
+8
source share

All Articles