from
bokeh.io
import
output_file, show
from
bokeh.layouts
import
row
from
bokeh.plotting
import
figure
import
numpy as np
import
random
fig1
=
figure(title
=
"Plot 1"
)
x
=
[[[[
0
,
0
,
1
,
1
]]],
[[[
2
,
2
,
4
,
4
], [
2.5
,
2.5
,
3.5
,
3.5
]]],
[[[
2
,
0
,
4
]]]]
y
=
[[[[
2.5
,
0.5
,
0.5
,
2.5
]]],
[[[
1
,
0
,
0
,
1
], [
0.75
,
0.25
,
0.25
,
0.75
]]],
[[[
2
,
0
,
0
]]]]
color
=
[
"red"
,
"purple"
,
"yellow"
]
fill_alpha
=
0.5
fig1.multi_polygons(x, y,
color
=
color,
fill_alpha
=
fill_alpha)
x
=
np.arange(
5
)
y
=
x
*
*
2
z
=
x
*
3
p
=
np.linspace(
1
,
20
,
7
)
q
=
np.linspace(
1
,
10
,
7
)
r
=
np.linspace(
1
,
30
,
5
)
a
=
np.arange(
31
)
fig2
=
figure(title
=
"Plot 2"
)
fig2.circle(x, y, color
=
"red"
, size
=
20
)
fig2.square(x, z, color
=
"blue"
, size
=
15
, alpha
=
0.5
)
fig2.
hex
(y, z, color
=
"green"
, size
=
10
, alpha
=
0.7
)
fig2.line(x, y, color
=
"green"
, line_width
=
4
)
fig2.inverted_triangle(p, q, color
=
"yellow"
, size
=
20
, alpha
=
0.4
)
fig2.diamond(x, r, color
=
"purple"
, size
=
16
, alpha
=
0.8
)
fig2.cross(a, a, size
=
14
)
x
=
[]
y
=
[]
for
i
in
range
(
100
):
x.append(i)
for
i
in
range
(
100
):
y.append(
1
+
random.random())
line_color
=
"red"
line_dash
=
"solid"
legend_label
=
"Line 1"
fig3
=
figure(title
=
"Plot 3"
)
fig3.line(x, y,
line_color
=
line_color,
line_dash
=
line_dash,
legend_label
=
legend_label)
x
=
[]
y
=
[]
for
i
in
range
(
100
):
x.append(i)
for
i
in
range
(
100
):
y.append(random.random())
line_color
=
"green"
line_dash
=
"dotdash"
line_dash_offset
=
1
legend_label
=
"Line 2"
fig3.line(x, y,
line_color
=
line_color,
line_dash
=
line_dash,
line_dash_offset
=
line_dash_offset,
legend_label
=
legend_label)
show(row(fig1, fig2, fig3))