Repository navigation
Custom Colour Scale Creation - #262
Conversation
There was a problem hiding this comment.
Going to reject this immediately as methods in the plot submodule should actually plot things, move them into a new/different submodule.
The only exception is plot helpers (which I can see that some of these might fit into)
If you want them as described in the changelog you would have the following structure:
- Python_Engine/Python/src/python_toolkit
- plot
- ...
- palettes
- ...
- colour_scales
- ...
- plot
Tom-Kingstone
left a comment
There was a problem hiding this comment.
This looks good now, and that display function for the drop down is also probably going to be useful elsewhere (every day we get closer to fully supporting enums in drop downs ;)).
Noting here an idea for the registry is to have some sort of "colour scale category" that can be sorted by (i.e. how matplotlib categorises them in their colour map page) of course a scale can have multiple categories (colour blind safe + categorical, colour blind safe + continuous etc.)
|
@BHoMBot check required |
|
@BHoMBot check ready-to-merge |
|
@Felix-Mallinder to confirm, the following actions are now queued:
There are 187 requests in the queue ahead of you. |
Issues addressed by this PR
Closes #217
Adds custom colour maps and colour scales to the BHoM Tkinter UI.
A colour scale keeps its band thresholds in data units (e.g. 18 / 21 / 24 degC) and gives a matching matplotlib
(Colormap, BoundaryNorm), so a saved scale colours any data consistently.palettes: one registry of matplotlib and toolkit palettes, with acolourblindset.colour_scales:ColourScale, break suggestion from data (equal,quantile,jenks,nice,log) and a saved scales file (load_scales,save_scale,delete_scale).plot/colour_scale_histogram.py: histogram of data over a scale's bands, used as the builder preview.ColourScaleBuilderwindow: histogram, suggested breaks, edit thresholds, colours and labels, split or remove bands, save.CmapSelector: newinclude_scales,data,unitsandscales_pathoptions. Saved scales are listed asName (scale)with New / Edit / Delete buttons, andget_scale()/get_norm()return the selection.CmapSelectorpalette lists now come frompalettes, soCATEGORICAL_CMAPSandCONTINUOUS_CMAPSare removed. Nothing in this repo used them.Test files
Tests included:
tests/test_colour_scales.pyandtests/test_colour_scale_builder.py.Changelog
palettesandcolour_scalesmodules.ColourScaleBuilder.CmapSelectorcan build, edit and delete saved colour scales.Additional comments
palettesandcolour_scalesmoved out ofplot/into their own modules, per review.