@@ -34,6 +34,7 @@ def _():
3434 from wigglystuff import ParallelCoordinates
3535
3636 from anywidget_vector import VectorSpace
37+
3738 return PCA , ParallelCoordinates , VectorSpace , fetch_openml , mo , np , pl , plt
3839
3940
@@ -244,10 +245,12 @@ def _(LABEL_COLORS, ParallelCoordinates, df, mo, vs):
244245 _indices = sorted (int (sid .split ("_" )[1 ]) for sid in _selected )
245246 _filtered_df = df [_indices ]
246247 _par = ParallelCoordinates (_filtered_df , color_by = "label" , color_map = LABEL_COLORS )
247- mo .vstack ([
248- mo .md (f"**{ len (_indices )} ** points selected in 3D view" ),
249- mo .ui .anywidget (_par ),
250- ])
248+ mo .vstack (
249+ [
250+ mo .md (f"**{ len (_indices )} ** points selected in 3D view" ),
251+ mo .ui .anywidget (_par ),
252+ ]
253+ )
251254 else :
252255 mo .md ("*Lasso or box-select points in the 3D view to filter*" )
253256 return
@@ -258,13 +261,7 @@ def _(LABEL_COLORS, idx, images, label_names, labels, np, plt, vs, widget):
258261 _selected_ids = set (vs .widget .selected_points or [])
259262 _filtered = widget .widget .filtered_indices
260263
261- if _selected_ids :
262- _show = [
263- _i for _i in range (len (idx ))
264- if f"p_{ _i } " in _selected_ids
265- ][:10 ]
266- else :
267- _show = list (_filtered [:10 ])
264+ _show = [_i for _i in range (len (idx )) if f"p_{ _i } " in _selected_ids ][:10 ] if _selected_ids else list (_filtered [:10 ])
268265
269266 _sample_idx = np .array (_show ) if len (_show ) > 0 else np .array ([0 ])
270267
0 commit comments