Add a category widget

Category widgets group features from string columns into aggregated categories based on their occurence in your current map view and displayed with their associated counts. You can filter on a particular category by selecting it and by default, as you zoom or pan the map, the values in the widget update to the current viewport.

To see available parameters run help(category_widget).

In the example below, the category widget summarizes the types of collisions in Seattle.


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

set_default_credentials('cartoframes')

In [2]:
Layer(
    'seattle_collisions',
    widgets=[
        category_widget(
            'collisiontype',
            title='Type of Collision',
            description='Select a category to filter'
        )
    ]
)


Out[2]:
:
StackTrace
    ">