I was trying to create a close area using Bokeh. That is how I have done that,
from bokeh.plotting import figure, output_file, show
p = figure(title="line", plot_width=300, plot_height=300)
p.line([1, 2, 3, 4, 5, 1], [6, 7, 8, 7, 3, 6])
p.scatter([1, 2, 3, 4, 5, 1], [6, 7, 8, 7, 3, 6])
show(p)
Now I want to find out the length of each line using this function:
def distance(x1, y1, x2, y2):
# compute cartesian distance
return np.sqrt((x1-x2)**2 + (y1-y2)**2)
want to attach the information in each line as a line label. I am having difficulties. Can somebody please help.
here is my bokeh plotting:
However,I want to achieve something like this with proper labeling:
I will be so grateful if someone helps me to achieve this.