By default, CARTOframes sets the center and zoom of your map to encompass all features in a dataset. In the cases where you want to set a custom extent, setting show_info=True
places zoom and latitude/longitude coordinates at the bottom left corner of the map. Copying and pasting the values to the viewport
parameter sets the opening zoom and center of the map.
In [1]:
from cartoframes.auth import set_default_credentials
from cartoframes.viz import Map, Layer
set_default_credentials('cartoframes')
In [2]:
Map(
Layer('pittsburgh_311'),
show_info=True,
viewport={'zoom': 13.5, 'lat': 40.4353, 'lng': -79.9916}
)
Out[2]: