Skip to content

Commit 60e839b

Browse files
authored
remove unnecessary tools (bokeh#14332)
1 parent 6016f68 commit 60e839b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

examples/models/legends.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
from bokeh.core.enums import LegendLocation
1313
from bokeh.io import show
14-
from bokeh.models import (ColumnDataSource, DataRange1d, Legend, Line, LinearAxis,
15-
PanTool, Plot, SaveTool, Scatter, WheelZoomTool)
14+
from bokeh.models import (ColumnDataSource, DataRange1d, Legend,
15+
Line, LinearAxis, Plot, Scatter)
1616

1717
x = linspace(-2*pi, 2*pi, 400)
1818
y = sin(x)
@@ -39,17 +39,12 @@
3939
circle = Scatter(x="x", y="y2", size=6, line_color="red", fill_color="orange", fill_alpha=0.6)
4040
circle = plot.add_glyph(source, circle)
4141

42-
pan = PanTool()
43-
wheel_zoom = WheelZoomTool()
44-
preview_save = SaveTool()
45-
46-
plot.add_tools(pan, wheel_zoom, preview_save)
47-
4842
# Add axes (Note it's important to add these before adding legends in side panels)
4943
plot.add_layout(LinearAxis(), "below")
5044
plot.add_layout(LinearAxis(), "left")
5145
plot.add_layout(LinearAxis(), "right")
5246

47+
5348
def add_legend(location, orientation, side, background_fill_color="#FFFFFF"):
5449
legend = Legend(
5550
items=[("line", [line]), ("circle", [circle])],
@@ -61,14 +56,15 @@ def add_legend(location, orientation, side, background_fill_color="#FFFFFF"):
6156
)
6257
plot.add_layout(legend, side)
6358

59+
6460
# Add legends in names positions e.g. "top_right", "top_left" (see plot for all)
6561
for location in LegendLocation:
6662
# redundant positions get a different background color and a vertical orientation to show ambiguity
6763
if "_" not in location:
6864
background_fill_color = "#999999"
6965
orientation = "vertical"
7066
else:
71-
background_fill_color ="#CCCCCC"
67+
background_fill_color = "#CCCCCC"
7268
orientation = "horizontal"
7369
add_legend(location, orientation, "center", background_fill_color=background_fill_color)
7470

0 commit comments

Comments
 (0)