Last active
May 8, 2018 17:14
-
-
Save schaunwheeler/d6c4fadfd35bf6595d124ad07e569b68 to your computer and use it in GitHub Desktop.
Snapshot of `prepare_plot` method from https://gist.github.com/schaunwheeler/9a98d8bee5f039e9872c76fb24a6e69c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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