Closed zackarno closed 1 year ago
So, we do have the functionality of RColorBrewer::brewer.pal()
. I constructed hdx_pal()
, and the others shade specific ones hdx_pal_mint()
, hdx_pal_tomato()
and hdx_pal_sapphire()
the same way that ggthemes
constructed the palette functions. That is, they are a constructor function that once run, returns a palette that can then be used with n
. Try hdx_pal_mint()(3)
for instance, or hdx_pal()(6)
.
Now, I"m trying to remember what the advantage was to constructing it in this manner rather than directly just having a the brewer.pal()
setup. I can't remember, so maybe we can investigate in time and make a decision to switch to the direct palette format. I don't think that would necessarily be a problem at all and might make it easier for the user.
Agreed on the display.brewer.all()
format.
I didn't realize they worked like this, good to know - should be sweet, but also down to test out different options.
hmmm, that example didn't seem to work. Any suggestions?
gghdx::hdx_pal_mint()[1]
#> Error in gghdx::hdx_pal_mint()[1]: object of type 'closure' is not subsettable
Created on 2022-12-08 by the reprex package (v2.0.1)
hmmm, that example didn't seem to work. Any suggestions?
gghdx::hdx_pal_mint()[1] #> Error in gghdx::hdx_pal_mint()[1]: object of type 'closure' is not subsettable
Created on 2022-12-08 by the reprex package (v2.0.1)
oh my bad I use square brackets which was wrong.... gghdx::hdx_pal_mint()(1)
does work
Yeah, it's a function generator so gotta call the next one as a function!
So, just revisiting some things, and note that hdx_pal()
as a generator function (and all the other hdx_pal...()
functions) are required for the scale_fill_...()
and scale_color_...()
functions. Hence why constructed that way.
However, will look into recreating a brewer.display.all()
function soon.
Fixed in #13
RColorBrewer::brewer.pal()
is one of the palette functions I tend to use most.Would be cool to have an equivalent where you just specify
n
and palettename
and the hex codes are returned. I seehdx_pal()
, but doesn't look like it's designed the same way.Also an accompanying equivalent to
RColorBrewer::display.brewer.all()
would be awesome eventually