dcard commited on
Commit
25de15c
1 Parent(s): 3bdca18

updating max bins

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -24,9 +24,9 @@ pn.extension()
24
 
25
  temp = sorted(source['IMDB_Rating'].dropna().values)
26
 
27
- max_bins = int(np.ceil(max(temp))+ 1 - np.floor(min(temp)))
28
 
29
- def create_plot(bandwidth=1.0, bins=max_bins):
30
  plot = figure(width=300, height=300, toolbar_location=None)
31
 
32
  # Histogram
@@ -49,7 +49,7 @@ def create_plot(bandwidth=1.0, bins=max_bins):
49
 
50
 
51
  bw_widget = pn.widgets.FloatSlider(name="Bandwidth", value=1.0, start=0.03, end=2.0, step=0.02)
52
- bins_widget = pn.widgets.IntSlider(name="Number of Bins", value=max_bins, start=1, end=max_bins)
53
 
54
  bound_plot = pn.bind(create_plot, bandwidth=bw_widget, bins=bins_widget)
55
 
 
24
 
25
  temp = sorted(source['IMDB_Rating'].dropna().values)
26
 
27
+ n_int_bins = int(np.ceil(max(temp))+ 1 - np.floor(min(temp)))
28
 
29
+ def create_plot(bandwidth=1.0, bins=n_int_bins):
30
  plot = figure(width=300, height=300, toolbar_location=None)
31
 
32
  # Histogram
 
49
 
50
 
51
  bw_widget = pn.widgets.FloatSlider(name="Bandwidth", value=1.0, start=0.03, end=2.0, step=0.02)
52
+ bins_widget = pn.widgets.IntSlider(name="Number of Bins", value=n_int_bins, start=1, end=n_int_bins*10)
53
 
54
  bound_plot = pn.bind(create_plot, bandwidth=bw_widget, bins=bins_widget)
55