Last active
August 29, 2015 14:19
-
-
Save alstat/594c7074890f4dc8b4d1 to your computer and use it in GitHub Desktop.
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 * | |
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