Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement