# importing show from
# bokeh.io to show the plot
from bokeh.io import show
# importing legend from bokeh.models
from bokeh.models import Legend
# importing figure from bokeh.plotting
from bokeh.plotting import figure
# importing numpy package from python
import numpy as np
x1 = [7, 8, 4, 3, 2, 9, 10, 11, 6, 6, 3]
y1 = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
# Creating an empty figure of plot height=600
# and plot width=600
fig = figure(plot_height=600, plot_width=600)
# Creating point1 in the form of circular glyphs
# with a set of points
point1 = fig.circle(x=np.arange(14),
y=[14, 13, 12, 11, 10, 9, 8, 7,
6, 5, 4, 3, 2, 1])
# Creating point2 in the form of triangular glyphs
# with a set of points
point2 = fig.triangle(x=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14],
y=[1, 4, 9, 16, 25, 36, 49, 64, 81, 100,
121, 144, 169, 196], size=30,
color="green", alpha=0.5)
# Creating point3 in the form of diamond shaped glyphs
# with a set of points
point3 = fig.diamond(x=[1, 2, 4],
y=[20, 19, 1],
color="red",
alpha=0.4)
# Creating point4 in the form of square shaped glyphs
# with a set of points
point4 = fig.square(x=[70, 80, 40, 30, 20, 10],
y=[10, 20, 40, 50, 60, 70],
color="red", size=20,
alpha=0.6)
# Creating point5 in the form of inverted triangular glyphs
# with a set of points
point5 = fig.inverted_triangle(x=[75, 85, 45, 35, 25, 15],
y=[15, 25, 45, 55, 65, 75],
color="purple", size=10, alpha=0.6)
# Creating point6 in the form of square shaped glyphs
# with a set of points
point6 = fig.square(x1, y1, color="yellow",
size=20, alpha=0.6)
# Using legend we are placing two point descriptions
# beside each other
# horizontally
legend1 = Legend(items=[("point1", [point1]),
("point2", [point2])],
location=(10, 10), orientation="horizontal")
# Using legend we are placing the other two point
# descriptions beside each other horizontally
legend2 = Legend(items=[("point3", [point3]), ("point4", [point4])],
location=(10, 10), orientation="horizontal")
# Using legend we are placing the other two point
# descriptions beside each other horizontally
legend3 = Legend(items=[("point5", [point5]), ("point6", [point6])],
location=(10, 10), orientation="horizontal")
# placing legend1 at the bottom
fig.add_layout(legend1, 'below')
# placing legend2 at the bottom
fig.add_layout(legend2, 'below')
# placing legend3 at the bottom
fig.add_layout(legend3, 'below')
# showing the figure
show(fig)