In [14]:
from bokeh.io import output_notebook, show, hplot, vplot
from bokeh.properties import value
from bokeh.plotting import figure
from bokeh.models import Circle, GMapPlot, Range1d, ColumnDataSource, BoxSelectTool, GMapOptions
output_notebook()


BokehJS successfully loaded.

Warning: BokehJS previously loaded


In [23]:
x_range = Range1d()
y_range = Range1d()


source = ColumnDataSource(
    data=dict(
        cost_goods=[100, 200, 300],
        cost_rent=[2000, 1000, 4000],
        lat=[30.2961, 30.2855, 30.2869],
        lon=[-97.7394, -97.7290, -97.7405],
    )
)

# Make the map (pulled from examples/glyphs/map.py)

map_options = GMapOptions(lat=30.2861, lng=-97.7394, map_type="roadmap", zoom=14, styles="""
[{"featureType":"administrative","elementType":"all","stylers":[{"visibility":"on"},{"lightness":33}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2e5d4"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#c5dac6"}]},{"featureType":"poi.park","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":20}]},{"featureType":"road","elementType":"all","stylers":[{"lightness":20}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#c5c6c6"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#e4d7c6"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#fbfaf7"}]},{"featureType":"water","elementType":"all","stylers":[{"visibility":"on"},{"color":"#acbcc9"}]}]
""")

mapplot = GMapPlot(
    x_range=x_range, y_range=y_range,
    map_options=map_options, plot_width=500, plot_height=500
)

circle = Circle(x="lon", y="lat", size=25, fill_color=value('red'), line_color=None)
mapplot.add_glyph(source, circle)
mapplot.add_tools(BoxSelectTool())

# Make the scatter plot

scatter = figure(title='Linked Scatter', width=300, height=300, tools='')
scatter.circle(source=source, x="cost_goods", y="cost_rent", size=25, fill_color='pink', line_color=None)

show(vplot(hplot(mapplot, scatter)))