Repository navigation
A more reusable Slicer - #553
Merged
Merged
Conversation
nvaytet
marked this pull request as draft
April 14, 2026 08:52
nvaytet
marked this pull request as ready for review
April 14, 2026 13:06
MridulS
reviewed
Apr 15, 2026
Comment on lines
-102
to
-109
| nodes = input_to_nodes( | ||
| obj, | ||
| processor=partial(preprocess, ignore_size=True, coords=coords), | ||
| ) | ||
|
|
||
| dims = nodes[0]().dims | ||
| if keep is None: | ||
| keep = dims[-(2 if len(dims) > 2 else 1) :] |
Member
There was a problem hiding this comment.
Shouldn't we still keep these checks? Slicer can still accept obj: PlottableMulti as input?
…re-reusable-slicer
MridulS
approved these changes
Apr 17, 2026
Member
Author
|
I ended up using the new functionality in one of the gallery notebooks. Code before: slider = pw.SliceWidget(da, dims=['time'])
slider_node = pp.widget_node(slider)
slice_node = pw.slice_dims(data_array=da, slices=slider_node)
fig = pp.scatter3dfigure(slice_node, size=0.3, cbar=True)
pp.widgets.Box([fig, slider])After: from plopp.plotting.slicer import Slicer
sl = Slicer(da, keep='pixel')
fig = pp.scatter3dfigure(sl.output, size=0.3, cbar=True)
fig.bottom_bar.add(sl.slider)
fig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We split the Slicer class into two parts:
outputattributeThe first one can then be used with other visualizations (e.g. the instrument view), while the second can be used by similar slicer views like the Superplot.
A quick example of something we can now do with this: update a html display from the slider
This should hopefully be quite useful for integrating as part of custom GUI interfaces.