Advertisement
Guest User

Untitled

a guest
May 25th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. from bokeh.plotting import *
  2. from bokeh.resources import CDN
  3. from bokeh.embed import file_html
  4.  
  5. # Define the figure
  6. p1 = figure(title = "Distribution of Age",
  7. x_axis_label = "Age",
  8. y_axis_label = "Number of Children",
  9. plot_width = 800,
  10. y_range = [-2, max(dat2.ix[:, "nchild"]) + max(dat2.ix[:, "nchild"]) * 0.1])
  11.  
  12. # Use rect for bar plot
  13. p1.rect(x = dat2.ix[:, "age"], y = dat2.ix[:, "nchild"]/2, width = 0.8, height = dat2.ix[:, "nchild"], color = "#2F8F28", alpha = 0.6)
  14.  
  15. # Set the width and height
  16. curplot().plot_width = 450
  17. curplot().plot_height = 450
  18.  
  19. output_file("barplot.html", title="Bar Plot")
  20. html = file_html(p1, CDN, "my plot")
  21.  
  22. # Show the plot
  23. show(p1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement