Skip to content

Instantly share code, notes, and snippets.

@schaunwheeler
Last active May 8, 2018 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schaunwheeler/d6c4fadfd35bf6595d124ad07e569b68 to your computer and use it in GitHub Desktop.
Save schaunwheeler/d6c4fadfd35bf6595d124ad07e569b68 to your computer and use it in GitHub Desktop.
"""
Code described in Medium post https://medium.com/@schaun.wheeler/codify-your-workflow-377f5f8bf4c3
Copyright (c) 2018 Valassis Digital under the terms of the BSD 3-Clause license.
"""
def prepare_plot(self, plot_width=700, plot_height=None, zoom=None, map_type='hybrid', **kwargs):
zoom_level, lat_center, lng_center, auto_plot_height = self._estimate_zoom_level(plot_width)
if plot_height is None:
plot_height = auto_plot_height
if zoom is None:
zoom = zoom_level
map_options = GMapOptions(lat=lat_center, lng=lng_center, map_type=map_type, zoom=zoom)
self.plot = GMapPlot(
x_range=Range1d(),
y_range=Range1d(),
map_options=map_options,
plot_width=plot_width,
plot_height=plot_height,
**kwargs
)
self.plot.api_key = self.api_key
self.plot.add_tools(WheelZoomTool(), ResetTool(), PanTool())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment