proplot
proplot copied to clipboard
Add from_file colormap generator and random color cycle generator
I want to add a few new color usage features at some point:
- Consider adding some of the NASA colormaps listed here, and ~~consider adding back Fabio Crameri's colormaps~~ (version 0.5.0).
- Add the image reader tool from climate_science_colormapping for loading colormaps. In #50 I added
LinearSegmentedColormap.from_file
andListedColormap.from_file
methods that load lists of hex strings, etc. I can let these methods read JPG and PNG files too. For colormaps, we try to read colors along the long-axis of the image (possibly with smoothing?), and for color cycles, we try to get distinct colors in the image. The latter would let us easily load cycles from tools like Color Hunt. - ProPlot can already be used to make new colormaps, but it should also be capable of making new color cycles. I can write an algorithm that selects random colors that are "sufficiently distinct" in perceptually uniform colorspace by (1) picking a random HCL coordinate, then (2) stepping in random directions in HCL space such that
delta_min <= square_root(delta_chroma^2 + delta_luminance^2 + min(delta_hue, 360 - delta_hue)^2) <= delta_max
. Therandom_cycle
function should accept an initial color and thedelta_min
anddelta_max
bounds as optional arguments, and the value ofdelta
can be randomly selected between those bounds, then randomly divided into hue, chroma, and luminance steps.
These are not a release priority but would be cool.