Skip to content

New grDevices::hcl.colors()

3 messages · Achim Zeileis, David Hugh-Jones

#
Hi everyone,

I wanted to draw your attention to a new post on the 
developer.R-project.org blog:
https://developer.R-project.org/Blog/public/2019/04/01/hcl-based-color-palettes-in-grdevices/

A new function grDevices::hcl.colors() greatly extends the color palette 
functionality available in base R. Also, the defaults in the heatmap 
functions image() and filled.contour() have been adapted accordingly.

Feedback is welcome, especially regarding potential problems with the 
changed defaults.

Best wishes,
Z
#
Hi Achim

Quick Q: why do some palettes have a hyphen in the name and others not?

David
On Tue, 2 Apr 2019 at 00:38, Achim Zeileis <Achim.Zeileis at uibk.ac.at> wrote:

            
#
Hi David:
I followed the naming conventions of the respective packages that provide 
the original for the the HCL-based approximations. But when you specify 
the palette name in hcl.colors() all hyphens, spaces, and the 
capitalization is ignored anyway:

R> hcl.colors(4, "Dark 3")
[1] "#E16A86" "#909800" "#00AD9A" "#9183E6"
R> hcl.colors(4, "dark3")
[1] "#E16A86" "#909800" "#00AD9A" "#9183E6"
R> hcl.colors(4, "Dark-3")
[1] "#E16A86" "#909800" "#00AD9A" "#9183E6"
R> hcl.colors(4, "Dark----------------3")
[1] "#E16A86" "#909800" "#00AD9A" "#9183E6"

So hopefully this does not lead to too much confusion.

Best wishes,
Z