Color bins legend

The color-bins legend draws a sequential color legend on your map that is based your data's geometry using either the color (default) or strokeColor property of your visualization.

To view available legend parameters, run help(color_bins_legend)

In this example, the color bins legend colors and labels the class break ranges for a classed map using the color property.


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

set_default_credentials('cartoframes')

In [2]:
Layer(
    'demographics_sf',
    color_bins_style('masters_percent'),
    legends=color_bins_legend(
        title="Percent Master's Degree",
        description='by block group',
        footer='Data: US Census',
        format='.0%'
    )
)


Out[2]:
Data: US Census
:
StackTrace
    ">