#!/usr/bin/env python # coding: utf-8 # ## Multiple widgets # # CARTOframes provides the ability to add multiple widgets to a Layer. # # This example uses two formula widgets to count the number of pedestrians and cyclists involved in collisions and a category widget describing the type of collisions. You can zoom and/or pan the map to update widget values. In addition, if you filter on a category, the formula widgets will update to reflect the values of that category in the current map view. # In[1]: from cartoframes.auth import set_default_credentials set_default_credentials('cartoframes') # In[2]: from cartoframes.viz import Layer, formula_widget, category_widget Layer( 'seattle_collisions', widgets=[ formula_widget( 'pedcount', 'sum', title='Pedestrians Involved' ), formula_widget( 'pedcylcount', 'sum', title='Cyclists Involved' ), category_widget( 'collisiontype', title='Collision Type' ) ] )