I'm trying to plot a graph using Bokeh. I did it using matplotlib but I can't figure out how I can plot 2D array using Bokeh.
This is my code for plotting with matplotlib:
[row, col] = point_data.shape
# select columns names
text = point_data.columns
# find string index:
range_ind = np.array(text.str.find('Range_cm')) > -1
range_cm_mat = point_data.iloc[0:row, range_ind].values
plt.figure(figsize=(19, 10))
plt.plot(range_cm_mat, '.', markersize=0.5, color='#1f77b4')
plt.show()
My data I'm plotting is from a CSV file and it is filtered by the string above.
Please help me figure out how I can show this plot with Bokeh library
This is what I tried and it isn't the way...
def make_scatter(title, x_title, y_title, x, y):
p = figure(title=title, toolbar_location="below", background_fill_color="#fafafa")
p.circle(x, y) # , alpha=0.5)
p.y_range.start = 0
p.legend.location = "center_right"
p.legend.background_fill_color = "#fefefe"
p.xaxis.axis_label = x_title
p.yaxis.axis_label = y_title
p.grid.grid_line_color = "white"
return p
x = np.arange(1, np.size(plot[0]), 1)
for i in range (np.size(plot[0])):
p1 = make_scatter("Range/Frames", 'Range [m]', 'Frames', [pt[i] for pt in plot], x)
show(p1)
This is how the data looks like: