Add a histogram widget

Histogram widgets display the distribution of a numeric attribute, in buckets, to group ranges of values in your data. You can hover over each bar to see each bucket's values and count, and filter your map's data within a given range by selecting it. 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(histogram_widget).

In the example below, the number of vehicles involved in each collision in Seattle are grouped over 9 buckets.


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

set_default_credentials('cartoframes')

In [2]:
Layer(
    'seattle_collisions',
    widgets=[
        histogram_widget(
            'vehcount',
            title='Number of Vehicles Involved',
            description='Select a range of values to filter',
            buckets=9
        )
    ]
)


Out[2]:
:
StackTrace
    ">