Instantly share code, notes, and snippets.

@alstat /samp9.py
Last active Aug 29, 2015

Embed
What would you like to do?
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