Plotting with different data structures
plotting with numpy, pandas and ColumnDataSource
Creating a plot using Numpy
import numpy as np
#original data points using linspace to generate 10 datapoints sequence
xdata = np.linspace(0, 2*np.pi, 10)
ydata = np.sin(xdata) # use sinus function to calculate the sinus ydata for xdata
# to be interpolated data point
xs = np.linspace(0, 2*np.pi, 50) #create 50 datapoints sequence
ys = np.interp(xs, xdata, ydata) #based on previous xdata, ydata relation estimate ys for xs
from bokeh.plotting import figure, output_file, show
output_file("interpolation.html")
p = figure(plot_height=400, plot_width=400, title="interpolation example")
p.circle(xdata,ydata,size=8,color='red',legend_label='data')
p.cross(xs,ys,size=8,color='blue', legend_label='interpolation')
p.line(xs,ys, color='lightgrey')
p.legend.location = "top_right"
show(p)
Creating a plot using Pandas DataFrame

Creating plot using ColumnDataSource
Last updated
