You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Bokeh example in chapter 7 (Analysis and Visualization) on page 173 is no longer compatible with current versions of Bokeh.
Below is the corrected example and a diff compared with the content of cell [9] in ch08-analysis-and-viz.ipynb:
importnumpyasnp# import the Bokeh plotting toolsfrombokehimportplottingasbp# as in the matplotlib example, load decays.csv into a NumPy arraydecaydata=np.loadtxt('data/decays.csv',delimiter=",",skiprows=1)
# provide handles for the x and y columnstime=decaydata[:,0]
decays=decaydata[:,1]
# define some output file metadatabp.output_file("decays.html", title="Experiment 1 Radioactivity")
# create a figure with fun Internet-friendly features (optional)f=bp.figure(tools="pan,wheel_zoom,box_zoom,reset,previewsave",
title="Decays", x_axis_label="Time (s)", y_axis_label="Decays (#)" )
# on that figure, create a line plotf.line(time, decays, color='#1F78B4', legend='Decays per second' )
# additional customization to the figure can be specified separatelyf.grid.grid_line_alpha=0.3# open a browserbp.show(f)
--- bokeh_old.py 2017-05-04 15:31:54.268924393 -0230+++ bokeh_new.py 2017-05-04 15:31:02.076925327 -0230@@ -13,15 +13,15 @@
bp.output_file("decays.html", title="Experiment 1 Radioactivity")
# create a figure with fun Internet-friendly features (optional)
-bp.figure(tools="pan,wheel_zoom,box_zoom,reset,previewsave")+f = bp.figure(tools="pan,wheel_zoom,box_zoom,reset,previewsave",+ title="Decays", x_axis_label="Time (s)", y_axis_label="Decays (#)" )
# on that figure, create a line plot
-bp.line(time, decays, x_axis_label="Time (s)", y_axis_label="Decays (#)",- color='#1F78B4', legend='Decays per second')+f.line(time, decays, color='#1F78B4', legend='Decays per second' )
# additional customization to the figure can be specified separately
-bp.curplot().title = "Decays"-bp.grid().grid_line_alpha=0.3+f.grid.grid_line_alpha=0.3
# open a browser
-bp.show()+bp.show(f)
The text was updated successfully, but these errors were encountered:
The Bokeh example in chapter 7 (Analysis and Visualization) on page 173 is no longer compatible with current versions of Bokeh.
Below is the corrected example and a diff compared with the content of cell [9] in
ch08-analysis-and-viz.ipynb
:The text was updated successfully, but these errors were encountered: