[R] venneuler (java?) color palette 0 - 1

Achim Zeileis Achim.Zeileis at uibk.ac.at
Mon Oct 11 15:52:45 CEST 2010


On Mon, 11 Oct 2010, Karl Brand wrote:

> Hi Paul,
>
> That's pretty much awesome. Thank you very much.
>
> And combined with the colorspace package functions- rainbow_hcl() and 
> sequential_hcl() -make color selection easy. One thing i was digging for was 
> a function that yields a color palette *and* the hcl() call needed to produce 
> it. This would help me better understand the hcl format. So where i can get 
> the RGB codes like this-
>
>> rainbow_hcl(4)
> [1] "#E495A5" "#ABB065" "#39BEB1" "#ACA4E2"
>>
>
> - which is fine for color specification, is there a palette function that 
> might help obtain the hcl() call needed to produce a given palette? ie., the 
> 'h', 'c' and 'l' (and 'alpha' if appropriate) values for a given 
> color/shade??

The ideas underlying rainbow_hcl(), sequential_hcl(), and diverge_hcl() 
are described in the following paper

   Achim Zeileis, Kurt Hornik, Paul Murrell (2009).
   Escaping RGBland: Selecting Colors for Statistical Graphics.
   Computational Statistics & Data Analysis, 53(9), 3259-3270.
   doi:10.1016/j.csda.2008.11.033

A preprint PDF version of it is also available for download on my webpage.

In the paper you see how the HCL coordinates for the different palettes 
are constructed. The functions rainbow_hcl(), sequential_hcl(), and 
diverge_hcl() are all direct translations of this, consisting just of a 
few lines of code.

What may be somewhat confusing is that the functions call
   hex(polarLUV(L, C, H, ...))
instead of
   hcl(H, C, L, ...)
which may yield slightly different results. The reason for this is that 
the polarLUV() implementation in "colorspace" predates the base R 
implementation in hcl().

hth,
Z

> Thanks again and in advance for any further pointers,
>
> Karl
>
> On 10/10/2010 10:41 PM, Paul Murrell wrote:
>> Hi
>> 
>> On 11/10/2010 9:01 a.m., Karl Brand wrote:
>>> Dear UseRs and DevelopeRs
>>> 
>>> It would be helpful to see the color palette available in the
>>> venneuler() function.
>>> 
>>> The relevant par of ?venneuler states:
>>> 
>>> "colors: colors of the circles as values between 0 and 1"
>>> 
>>> -which explains color specification, but from what pallette? Short of
>>> trial and error, i'd really appreciate if some one could help me locate
>>> a "0 - 1" pallette for this function to aid with color selection.
>> 
>> The color spec stored in the VennDiagram object is multiplied by 360 to
>> give the "hue" component of an hcl() colour specification. For example,
>> 0.5 would mean the colour hcl(0.5*360, 130, 60)
>> 
>> Alternatively, you can control the colours when you call plot, for
>> example, ...
>> 
>> plot(ve, col=c("red", "green", "blue"))
>> 
>> ... should work.
>> 
>> Paul
>> 
>>> FWIW, i tried the below code and received the displayed error. I failed
>>> to turn up any solutions to this error...
>>> 
>>> Any suggestions appreciated,
>>> 
>>> Karl
>>> 
>>> 
>>> library(venneuler)
>>> 
>>> ve<- venneuler(c("A"=1, "B"=2, "C"=3, "A&C"=0.5, "A&B&C"=0.1))
>>> 
>>> class(ve)
>>> [1] "VennDiagram"
>>> 
>>> ve$colors<- c("red", "green", "blue")
>>> 
>>> plot(ve)
>>> 
>>> Error in col * 360 : non-numeric argument to binary operator
>>> 
>> 
>
> -- 
> Karl Brand <k.brand at erasmusmc.nl>
> Department of Genetics
> Erasmus MC
> Dr Molewaterplein 50
> 3015 GE Rotterdam
> P +31 (0)10 704 3409 | F +31 (0)10 704 4743 | M +31 (0)642 777 268
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list