Skip to content

Instantly share code, notes, and snippets.

@alstat
Last active August 29, 2015 14:19
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 alstat/594c7074890f4dc8b4d1 to your computer and use it in GitHub Desktop.
Save alstat/594c7074890f4dc8b4d1 to your computer and use it in GitHub Desktop.
from bokeh.plotting import *
from bokeh.resources import CDN
from bokeh.embed import file_html
# Define the figure
p1 = figure(title = "Distribution of Age",
x_axis_label = "Age",
y_axis_label = "Number of Children",
plot_width = 800,
y_range = [-2, max(dat2.ix[:, "nchild"]) + max(dat2.ix[:, "nchild"]) * 0.1])
# Use rect for bar plot
p1.rect(x = dat2.ix[:, "age"], y = dat2.ix[:, "nchild"]/2, width = 0.8, height = dat2.ix[:, "nchild"], color = "#2F8F28", alpha = 0.6)
# Set the width and height
curplot().plot_width = 450
curplot().plot_height = 450
output_file("barplot.html", title="Bar Plot")
html = file_html(p1, CDN, "my plot")
# Show the plot
show(p1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment