Skip to content

Instantly share code, notes, and snippets.

@aaronsnoswell
Created October 6, 2018 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronsnoswell/d60c54c619f2bee3df5fe2d7d9c5c3d9 to your computer and use it in GitHub Desktop.
Save aaronsnoswell/d60c54c619f2bee3df5fe2d7d9c5c3d9 to your computer and use it in GitHub Desktop.
A hello world example for the Bokeh plotting library
from bokeh.plotting import figure, output_file, show
import numpy as np
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
# Output to static HTML file
output_file("lines.html")
# Create a new plot with a title and axis labels
p = figure(title="Simple line plot", x_axis_label="x", y_axis_label="y")
# Add a line rendere with a legend and lin thickness
p.line(x, y, legend="Temp.", line_width=2)
# Show the results
show(p)
# Export directly to png - requires 'conda install selenium phantomjs pillow',
# and adds about 15 seconds to the runtime
#from bokeh.io import export_png
#export_png(p, filename="plot.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment