#!/usr/bin/env python # coding: utf-8 # ## Layout viewport # Use the `Layout` class to create a variety of map views for comparison. # # For more information, run `help(Layout)`. # # The first example sets a common viewport for all maps while the second sets two different viewports for maps. # In[1]: from cartoframes.auth import set_default_credentials set_default_credentials('cartoframes') # ### Same viewport # In[2]: from cartoframes.viz import Map, Layer, Layout, basic_style Layout([ Map(Layer('select * from drought_wk_1 where dm = 3', basic_style(color='#e15383'))), Map(Layer('select * from drought_wk_2 where dm = 3', basic_style(color='#e15383'))), Map(Layer('select * from drought_wk_3 where dm = 3', basic_style(color='#e15383'))), Map(Layer('select * from drought_wk_4 where dm = 3', basic_style(color='#e15383'))), ], is_static=True, viewport={'zoom': 3, 'lat': 33.4706, 'lng': -98.3457}) # ### Different viewports # In[3]: from cartoframes.viz import Map, Layer, Layout, basic_style Layout([ Map(Layer('drought_wk_1'), viewport={ 'zoom': 0.5 }), Map(Layer('select * from drought_wk_1 where dm = 1', basic_style(color='#ffc285'))), Map(Layer('select * from drought_wk_1 where dm = 2', basic_style(color='#fa8a76'))), Map(Layer('select * from drought_wk_1 where dm = 3', basic_style(color='#e15383'))), ], is_static=True, viewport={'zoom': 3, 'lat': 33.4706, 'lng': -98.3457})