In [1]:
import pandas as pd
import bokeh
import sys
print("Pandas version: \n\t{}".format(pd.__version__))
print("Bokeh version: \n\t{}".format(bokeh.__version__))
print("Python version: \n\t{}".format(sys.version))
In [2]:
from bokeh.plotting import figure, output_notebook, show
#Show plot in this Jupyter notebook
output_notebook()
In [13]:
#http://bokeh.pydata.org/en/latest/docs/user_guide/quickstart.html#
# prepare some data
x = [0.1, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
y0 = [i**2 for i in x]
y1 = [10**i for i in x]
y2 = [10**(i**2) for i in x]
# create a new plot
p = figure(
tools="pan,box_zoom,reset,save",
y_axis_type="log", y_range=[0.001, 10**11], title="log axis example",
x_axis_label='sections', y_axis_label='particles'
)
# add some renderers
p.line(x, x, legend="y=x")#plot a line corresponding to the (x,y) coordinates
p.circle(x, x, legend="y=x", fill_color="white", size=12) #place each (x,y) on the line as a circle with specified fill and size
p.line(x, y0, legend="y=x^2", line_width=6) #note use of line width
p.line(x, y1, legend="y=10^x", line_color="red") #note use of line color
p.circle(x, y1, legend="y=10^x", fill_color="red", line_color="red", size=6)
p.line(x, y2, legend="y=10^x^2", line_color="orange", line_dash="10 10") # note use of line dash
# show the results
# This will not render in github
# http://stackoverflow.com/questions/32518342/why-my-bokeh-plots-doesnt-work-on-github
show(p)
# workaround?
# http://stackoverflow.com/questions/32370281/how-to-include-image-or-picture-in-jupyter-notebook
In [14]:
from IPython.core.display import Image, display
display(Image('images/simple-xy-plot.png', width=600, unconfined=True))