@@ -53,6 +53,24 @@ def _get_plotly_colorscales():
5353PLOTLY_CMAPS = _get_plotly_colorscales ()
5454
5555
56+ class PlotlyUI :
57+
58+ def __init__ (self ):
59+ self .menu_cmap = None
60+ self .menu_color = None
61+ self .slider_size = None
62+
63+ def set_menu_cmap (self , mapper_plot , cmaps ):
64+ cmaps_plotly = [PLOTLY_CMAPS .get (c .lower ()) for c in cmaps ]
65+ self .menu_cmap = _ui_cmap (mapper_plot , cmaps_plotly )
66+
67+ def set_menu_color (self , mapper_plot , colors , titles , agg ):
68+ self .menu_color = _ui_color (mapper_plot , colors , titles , agg )
69+
70+ def set_slider_size (self , mapper_plot , node_sizes ):
71+ self .slider_size = _ui_node_size (mapper_plot , node_sizes )
72+
73+
5674def _to_cmaps (cmap : Union [str , List [str ]]) -> List [str ]:
5775 """Convert a single cmap or a list of cmaps to a list of cmaps."""
5876 if isinstance (cmap , str ):
@@ -488,32 +506,16 @@ def _layout():
488506 )
489507
490508
491- class PlotlyUI :
492-
493- def __init__ (self ):
494- self .menu_cmap = None
495- self .menu_color = None
496- self .slider_size = None
497-
498- def set_menu_cmap (self , mapper_plot , cmaps ):
499- cmaps_plotly = [PLOTLY_CMAPS .get (c .lower ()) for c in cmaps ]
500- self .menu_cmap = _ui_cmap (mapper_plot , cmaps_plotly )
501-
502- def set_menu_color (self , mapper_plot , colors , titles , agg ):
503- self .menu_color = _ui_color (mapper_plot , colors , titles , agg )
504-
505- def set_slider_size (self , mapper_plot , node_sizes ):
506- self .slider_size = _ui_node_size (mapper_plot , node_sizes )
507-
508-
509509def _set_ui (mapper_fig , plotly_ui : PlotlyUI ):
510510 menus = []
511511 sliders = []
512+ x = 0.0
512513 if plotly_ui .menu_cmap :
513- plotly_ui .menu_cmap ["x" ] = 0.25
514+ plotly_ui .menu_cmap ["x" ] = x
515+ x += 0.25
514516 menus .append (plotly_ui .menu_cmap )
515517 if plotly_ui .menu_color :
516- plotly_ui .menu_color ["x" ] = 0.0
518+ plotly_ui .menu_color ["x" ] = x
517519 menus .append (plotly_ui .menu_color )
518520 if plotly_ui .slider_size :
519521 plotly_ui .slider_size ["x" ] = 0.0
0 commit comments