pygraphistry
pygraphistry copied to clipboard
[ENH] Smarter auto color encodings
Palette selection is currently manual:
g.encode_point_color('my_col', ["color1", ...], , as_continuous=True)
Some possible improvements:
- Faster palette selection:
- named palettes, e.g., from color brewer
- if no palette is provided but continuous/categorical is known, pick a palette, and if data is available, try to right-size
- Automate labeling of as_continuous/as_categorical
If data is available, or at least dtype:
- categorical dtype -> categorical
- strings, bools -> categorical
- numeric, time -> continuous
Ex:
g.edges(events_df).encode_edge_color('time') => automatically cold-to-hot
Implementation wise, may be worthwhile to make lazy:
- at time of
.encode_point_color(): simple! - defer till
.plot(): data guaranteed to be available! - new
autosetting pushed to server: now client-independent: currently exception-raising calls will instead tag withauto, and server has freedom to handle during upload or pageload
I'm leaning towards 1. for now (simple), and as encodings refactor on the server, switch from narrow & strict semantics to 3's lazy.