Skip to content

Update positions of masked scatter points when updated - #558

Merged
nvaytet merged 2 commits into
mainfrom
move-scatter-masked-points
Apr 27, 2026
Merged

nvaytet merged 2 commits into
mainfrom
move-scatter-masked-points

Conversation

@nvaytet

@nvaytet nvaytet commented Apr 26, 2026

Copy link
Copy Markdown
Member

Example: the masked points were not being updated when the slider was used, only the orange points moved.

import plopp as pp
import scipp as sc
import ipywidgets as ipw

%matplotlib widget

a = pp.Node(pp.data.scatter())
b = pp.data.scatter(seed=2) * 10.0
b.masks['m'] = b.coords['y'] > sc.scalar(10, unit='m')
b = pp.Node(b)

slider = ipw.FloatSlider(
    min=0,
    max=60,
    value=30,
    description='Position of orange group',
    style={'description_width': 'initial'},
    layout={'width': '500px'},
)
slider_node = pp.widget_node(slider)


@pp.node
def move(da, x):
    out = da.copy(deep=False)
    out.coords['x'] = da.coords['x'] + sc.scalar(x, unit=da.coords['x'].unit)
    return out


move_node = move(da=b, x=slider_node)

f = pp.scatterfigure(a, move_node, cbar=False, autoscale=False)
f.bottom_bar.add(slider)
f.canvas.xrange = [-40, 100]
f
Screenshot_20260426_222109

@nvaytet
nvaytet merged commit 6151830 into main Apr 27, 2026
6 checks passed
@nvaytet
nvaytet deleted the move-scatter-masked-points branch April 27, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants