Created
October 6, 2018 03:27
-
-
Save aaronsnoswell/d60c54c619f2bee3df5fe2d7d9c5c3d9 to your computer and use it in GitHub Desktop.
A hello world example for the Bokeh plotting library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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