Flexible plotting class for sc.DataArray that maps dimensions to color, marker & linestyle, with a concise legend
#3914
doronbehar
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Very often I find myself dealing with
DataArrays with 3 or more dimensions, with sizes such as:{ "x": LARGE_INTEGER, "alpha": INTEGER_LESS_THEN_10, "beta": INTEGER_LESS_THEN_5, }And maybe with another dimension of 2-3 values. Plotting a combination of$\sim 50$ legend entries. The correct thing to do is to put only
yv.sxfor all combinations ofalphas andbetas, and adding a legend for it, will explode in this case toINTEGER_LESS_THEN_10+INTEGER_LESS_THEN_5legend entries such as:seabornsort of provides this feature: https://seaborn.pydata.org/generated/seaborn.lineplot.html , but it lacks customization of the legend and the error bar computation is too a bit too locked down IMO (Not to mention upstream's ignorance there!). Since scipp has excellent error propagation capabilities, it is easier to wire these to plots with errorbars, while not locking the legend too much.plopphas a single example here that demonstrates something simple like this, but it seems noploppfunction truly implements this mapping like the class I wrote below.ggplothas this feature, but it locks down the legend too so it seems, not to mention other matplotlib elements it simply sidesteps (example)Here are a few plot examples:
The code is available here:
https://gitlab.com/doronbehar/lab-ideal-scientific-workflows/-/blob/b71eddc9a59d46445d768134c4cdd1bbabd2d894/SciPlot.py
Disclaimer: I used Gemini to generate that script, but I read and edited thoroughly the class, and added many features completely myself after the initial AI attempt.
Comments and ideas are more then welcome!
All reactions