I can add them tomorrow, but it will be easier if I can find the actual color definitions somewhere, rather than just the swatches.
This page has more information https://matplotlib.org/tutorials/colors/colormaps.html
and also here https://matplotlib.org/tutorials/colors/colormap-manipulation.html
You can define your own colour maps in Plots.jl IIRC. Or let the user do it themselves?
Yes, Iāve always had plans to make the color maps in Fatou
independent of PyPlot
, which can be solved with the use of ColorSchemes
package. Unfortunately, Iāve not had the time to prioritize this.
The interface will generalize, please share if you have any specific interface example in mind.
The problem with ColorSchemes is that itās a package with a big list of heavy dependencies, which is unneccesary for just providing color schemes (but useful for doing the other things you can do here). @cormullion maybe we should make that dependency-free ColorMaps package that simply holds color swatches, uses submodules to hold different libraries, and can be depended on by Colors, ColorSchemes, PlotUtils, Makie etc.?
We could ask some of the other libraries like colorbrewer.jl and noveltycolors and perceptualcolormaps to just put swatches in there (or basic functions describing the rgb curves if thatās preferred) so that we consolidate colorschemes in Julia.
Sounds like a good idea ( ). Perhaps the dependency on Images.jl could be transferred to a ...Utils
package.
While converting the ones in https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/_cm.py I skipped a few, mainly the ones with lambda
s in them (since I donāt speak Python, Iām not sure what these lambda
s are doing).
_flag_data = {
'red': lambda x: 0.75 * np.sin((x * 31.5 + 0.25) * np.pi) + 0.5,
'green': lambda x: np.sin(x * 31.5 * np.pi),
'blue': lambda x: 0.75 * np.sin((x * 31.5 - 0.25) * np.pi) + 0.5,
}
which generates this (obviously very useful):
These lambda
s indicate anonymous functions (also called lambda functions).
In Julia,
lambda x: 0.75 * np.sin((x * 31.5 + 0.25) * np.pi) + 0.5
should be written as
x -> 0.75 * sin((x * 31.5 + 0.25) * pi) + 0.5
Great - letās start it under JuliaGraphics and start hashing on the design? I support the most minimal possible. I donāt think such a package would need any dependencies at all other than colors (for rgb). It should just have the colors, perhaps functionality to have both discrete and floating point indexing, and some default way of categorizing colorgradients (perhaps as traits) (sequential, categorical, diverging, isoluminant, monochromatic, color-blind friendly, perceptually uniform).
In particular I think it should distinguish those with good visual properties from those that donāt have that (like that awful flag scheme, or jet) as most people are naive about color gradients. Thatās been my biggest concern with doing that - at least in PlotUtils we can make sure that subpar schemes arenāt available.
Libraries in submodules would be a necessity, due to licensing and namespacing.
OK Iāll stop hijacking the thread
If you do start a repo/discussion, please link it here. I would make sure PGFPlotsX works with it, and also some packages could use it to split functionality.
Just because the flag
gradient isnāt useful for traditional plotting, doesnāt mean that itās completely useless
for example, it can be used to make that ^ which is fun since flag
acts like a topological covering-projection
That flag
colorscheme is a covering projection map, where each color is mapped from a disjoint domain
So I would hope all the color schemes are treated equallyā¦
I really would hope not but I think this can be solved by a trait-based approach that clearly highlights e.g. that this is inappropriate for visualization of numerical magnitudes but may have other uses (like also, eg. the topographical colors).
Technically, this is exactly what I used that map for, to visualize numerical values on a covering space, so the use which I used it for still is under numerical visualization, so I canāt accept that classification.
The string
interface is really convenient, because it makes reproducible color maps very simple / memorable and you only need to know letās say, one function to reach them all.
How do you envision using traits? There should be specific trait-based constructors, but there should also be a function which simply lets you pick from any color map from a string name without discrimination.
Yes, definitely