PlotThemes.jl
PlotThemes.jl copied to clipboard
Adding R's color brewer pallet
Would you consider adding the R color brewer pallete
e.g. dark2 pallete
dark2 = [
RGB(([ 27, 158, 119]/255)...),
RGB(([217, 95, 2]/255)...),
RGB(([117, 112, 179]/255)...),
RGB(([231, 41, 138]/255)...),
RGB(([102, 166, 30]/255)...),
RGB(([230, 171, 2]/255)...),
RGB(([166, 118, 29]/255)...),
RGB(([102, 102, 102]/255)...)
]
The colorbrewer palettes (which have nothing to do with R) are added. dark2
has been one of the few that was kept out for some time - but this open PR adds them https://github.com/JuliaPlots/PlotUtils.jl/pull/67
see also https://docs.juliaplots.org/latest/colors/#colorschemes
Thank you!
This does not really work:
using Plots, PlotThemes
clibrary(:colorbrewer)
plot(rand(5, 100)', lw=2, palette=:Dark2)
The automatically chosen colors are too similar and are hard to distinguish.
Especially 2, 3 and 4 in the above plot.
Did you check out that Pull Request I linked?
Oh I see it got merged. So this is on master? The colors do look a little off.
~~palette = palette(:Dark2)
works, but IMO palette = :Dark2
should also. Not sure what's the issue there, maybe a call to distinguishable_colors
or something.~~
EDIT: No it does not, it just uses the default palette, sorry ...
The problem seems to be in get_color_palette
which is called by plot when the palette
argument is supplied.
The following code would produce the correct color palette.
grad = cgrad(:Dark2)
RGBA{Float64}[grad[z] for z in 1:numcolors]
zrng = get_zvalues(numcolors)
produces a weird, unordered list of values between 0 and 1 which may be beneficial if the underlying cgrad
is ordered in some sense. But in this case it is not.
Yes, we had some discussion about how to best add the categorical palettes, as they are something different from color gradients. We ended up agreeing that we could just include them and it would be fine. Looks like that wasn't correct.
So, do you think we need a type different from ColorGradient
for categorical palettes?
I think distinguishing between them could be a possibility yes. But a little unsure of the repercussions