Color category legend

The color-category type draws a categorical 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_category_legend)

In this example, the category legend draws the top 3 tree species types in San Francisco.


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

set_default_credentials('cartoframes')

In [2]:
Layer(
    'trees_sf',
    color_category_style('common_species'),
    legends=color_category_legend(
        title='Trees in San Francisco',
        description='Top 3 species',
        footer='Data: City of SF'
    )
)


Out[2]:
Data: City of SF
:
StackTrace
    ">