Skip to content

Instantly share code, notes, and snippets.

@WillKoehrsen
Last active March 17, 2018 13:47
Show Gist options
  • Save WillKoehrsen/844b394da289ee6b79c3526c42d807c0 to your computer and use it in GitHub Desktop.
Save WillKoehrsen/844b394da289ee6b79c3526c42d807c0 to your computer and use it in GitHub Desktop.
# bokeh basics
from bokeh.plotting import figure
from bokeh.io import show, output_notebook
# Create a blank figure with labels
p = figure(plot_width = 600, plot_height = 600,
title = 'Example Glyphs',
x_axis_label = 'X', y_axis_label = 'Y')
# Example data
squares_x = [1, 3, 4, 5, 8]
squares_y = [8, 7, 3, 1, 10]
circles_x = [9, 12, 4, 3, 15]
circles_y = [8, 4, 11, 6, 10]
# Add squares glyph
p.square(squares_x, squares_y, size = 12, color = 'navy', alpha = 0.6)
# Add circle glyph
p.circle(circles_x, circles_y, size = 12, color = 'red')
# Set to output the plot in the notebook
output_notebook()
# Show the plot
show(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment