In [1]:
from __future__ import print_function
from bokeh.models import (
Range1d, ColumnDataSource, HoverTool,
)
from bokeh.plotting import figure, show, output_notebook
from bokeh.sampledata.airports import data as airports
from bokeh.tile_providers import STAMEN_TONER
title = "US Airports: Field Elevation > 1500m"
output_notebook()
points_source = ColumnDataSource(airports)
In [2]:
# set to roughly extent of points
x_range = Range1d(start=-15473429, end=2108550, bounds=None)
y_range = Range1d(start=-6315661, end=7264686, bounds=None)
# create plot and add tools
p = figure(tools='wheel_zoom,pan', x_range=x_range, y_range=y_range, title=title)
p.axis.visible = False
hover_tool = HoverTool(tooltips=[("Name", "@name"), ("Elevation", "@elevation (m)")])
p.add_tools(hover_tool)
p.add_tile(STAMEN_TONER)
# create point glyphs
p.circle(x='x', y='y', size=9, fill_color="#60ACA1", line_color="#D2C4C1", line_width=1.5, source=points_source)
show(p)
Out[2]:
In [3]:
# set to roughly extent of points
x_range = Range1d(start=-15473429, end=2108550)
y_range = Range1d(start=-6315661, end=7264686)
# create plot and add tools
p = figure(tools='wheel_zoom,pan', x_range=x_range, y_range=y_range, title=title, width=900, height=450)
p.axis.visible = False
hover_tool = HoverTool(tooltips=[("Name", "@name"), ("Elevation", "@elevation (m)")])
p.add_tools(hover_tool)
p.add_tile(STAMEN_TONER)
# create point glyphs
p.circle(x='x', y='y', size=9, fill_color="#60ACA1", line_color="#D2C4C1", line_width=1.5, source=points_source)
show(p)
Out[3]:
In [11]:
# set to roughly extent of points
x_range = Range1d(start=-15473429, end=2108550, bounds='auto')
y_range = Range1d(start=0, end=7264686, bounds=(0, 7264686))
# create plot and add tools
p = figure(tools='wheel_zoom,pan,reset', x_range=x_range, y_range=y_range, title=title, width=900, height=450)
p.axis.visible = False
p.add_tile(STAMEN_TONER)
# create point glyphs
p.circle(x='x', y='y', size=9, fill_color="#60ACA1", line_color="#D2C4C1", line_width=1.5, source=points_source)
show(p)
Out[11]:
In [ ]: