-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dimension slicer plot #19
Conversation
…ck and forth between mesh and figure to make this in a nice way. we would have ended up with the same kind of code as in the old plotting
Comment before having looked at the implementation: I feel this is backwards. Wouldn't it be more natural to specify the dims the user wants to see? |
Would it be an option to make one plot for each axis combination, and show only the selected one? The old buttons next to the slider essentially act like tab-selection buttons, i.e., it simply selects a different figure to show. |
I don't mind either way. pp.slicer(da, keep=['x']) # keep only 'x' -> makes a 1d line with 2 sliders
pp.slicer(da, keep=['x', 'y']) # keep 'x' and 'y' -> makes a 2d image with 1 slider along 'z' |
I feel this is really adding complication for not much gain. And the different tabs wouldn't help you with the handling of the log scales on the axes. In any case, I don't want to add them now and make things more complicated than they are. If users later say this is an absolute must have, then we can add them later, maybe using what you suggest. |
We should probably just get user feedback/opinions. |
"id": "a175931f-a0fd-48f7-83cc-9db14d454535", | ||
"metadata": {}, | ||
"source": [ | ||
"# Slicer plot\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As shown by a user comment on Slack, the name "Slicer" may be misleading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any better ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ask the users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greg says slicer
is fine in the end.
@@ -13,6 +13,7 @@ testpaths = "tests" | |||
filterwarnings = [ | |||
"error", | |||
"ignore::UserWarning", | |||
"ignore::PendingDeprecationWarning", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to make this specific to Matplotlib. This arose when updating to Matplotlib 3.6 where get_cmap
raises this warning. They say to use the syntax
cmap = matplotlib.colormaps[name]
instead of
cmap = matplotlib.cm.get_cmap(name)
However, the new syntax does not exist in mpl<3.5
. I thought I would keep it compatible?
Alternatively I can just use the new syntax and put a lower bound on the MPL requirement?
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave it for now.
src/plopp/wrappers.py
Outdated
The object to be plotted. Possible inputs are: | ||
- Variable | ||
- Dataset | ||
- DataArray | ||
- numpy ndarray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type hints should take care of this?
Merging so I can more easily move with other PRs |
This allows to slice higher dimensions with sliders.
Example:
We are not adding the buttons from the old plotting that allowed to flip the dimensions interactively because this would lead to too much entangled code between the
Mesh
and theFigure
, where a newMesh
would have to be made, the axis limits would have to be changed, and what to do with thelog
scales of the axes.Instead, we make an easy to use API where
keep
is alist
of dimensions to allow the user to quickly get what they want by re-plotting, instead of changing dims dynamically after the plot was made.Fixes #14