Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def plane_segmentation_2d_widget(plane_seg: PlaneSegmentation, **kwargs):
categorical_columns = infer_categorical_columns(plane_seg)
if len(categorical_columns) == 1:
color_by = list(categorical_columns.keys())[0]
return show_plane_segmentation_2d(plane_seg, color_by=color_by, **kwargs)
elif len(categorical_columns) > 1:
cat_controller = widgets.Dropdown(options=list(categorical_columns), description='color by')
out_fig = show_plane_segmentation_2d(plane_seg, color_by=cat_controller.value, **kwargs)
def on_change(change, out_fig=out_fig):
if change['new'] and isinstance(change['new'], dict):
ind = change['new']['index']
if isinstance(ind, int):
color_by = change['owner'].options[ind]
show_plane_segmentation_2d(plane_seg, color_by=color_by, fig=out_fig, **kwargs)
def get_groups(self):
return infer_categorical_columns(self.dynamic_table)
def get_groups(self):
return infer_categorical_columns(self.trials)