@@ -137,10 +137,13 @@ def n_bins_auto(res):
137137 return len (np .histogram_bin_edges (res .bins , bins = "auto" , range = (min_ , max_ ))) - 1
138138
139139
140- def figure (res , palette , n_bins , output_name ):
140+ def figure (res , palette , n_bins , kind , output_name ):
141+ kind = "histogram" if kind == "Stacked histogram" else "boxplot"
141142 plt .close ("all" )
142143 fig , ax = plt .subplots ()
143- _ = sd .visualization (bins = res .bins , palette = palette , n_bins = n_bins , ax = ax )
144+ _ = sd .visualization (
145+ bins = res .bins , palette = palette , n_bins = n_bins , kind = kind , ax = ax
146+ )
144147 ax .set (xlabel = output_name )
145148 return fig
146149
@@ -248,11 +251,19 @@ def tableau_states(res, states):
248251 format = PrintfTickFormatter (format = "%d bins" ),
249252)
250253
254+ switch_histogram_boxplot = pn .widgets .RadioButtonGroup (
255+ name = "Switch histogram - boxplot" ,
256+ options = ["Stacked histogram" , "Boxplot" ],
257+ inline = False ,
258+ width = 400 ,
259+ )
260+
251261interactive_figure = pn .bind (
252262 figure ,
253263 interactive_decomposition ,
254264 interactive_palette ,
255265 selector_n_bins ,
266+ switch_histogram_boxplot ,
256267 selector_output ,
257268)
258269
@@ -317,6 +328,9 @@ def tableau_states(res, states):
317328 height_policy = "min" ,
318329 )
319330 ),
331+ pn .Spacer (height = 50 ),
332+ switch_histogram_boxplot ,
333+ pn .Spacer (height = 50 ),
320334 selector_n_bins ,
321335 ),
322336 pn .Column (
0 commit comments