pygraphistry icon indicating copy to clipboard operation
pygraphistry copied to clipboard

[ENH] Smarter auto color encodings

Open lmeyerov opened this issue 5 years ago • 0 comments

Palette selection is currently manual:

g.encode_point_color('my_col', ["color1", ...], , as_continuous=True)

Some possible improvements:

  1. 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
  1. 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:

  1. at time of .encode_point_color(): simple!
  2. defer till .plot(): data guaranteed to be available!
  3. new auto setting pushed to server: now client-independent: currently exception-raising calls will instead tag with auto, 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.

lmeyerov avatar Sep 18 '20 22:09 lmeyerov