Add 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 where 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 relflect the values of that category in the current map view.


In [1]:
from cartoframes.auth import set_default_credentials
from cartoframes.viz import Layer, formula_widget, category_widget

set_default_credentials('cartoframes')

In [2]:
Layer(
    'seattle_collisions',
    widgets=[
        formula_widget(
            'pedcount',
            'sum',
            title='Pedestrians Involved'
        ),
        formula_widget(
            'pedcylcount',
            'sum',
            title='Cyclists Involved'
        ),
        category_widget(
            'collisiontype',
            title='Collision Type'
        )
    ]
)


Out[2]:
:
StackTrace
    ">