The size-bins
type draws a classed legend based on point or line data using either the size
(default) or stroke_width
property of your visualization.
To view available legend parameters, run help(size_bins_legend)
In this example, the size bins legend reads from the size
property to draw a classed legend of travel speeds with ranges labeled.
In [1]:
from cartoframes.auth import set_default_credentials
from cartoframes.viz import Layer, size_bins_style, size_bins_legend
set_default_credentials('cartoframes')
In [2]:
Layer(
'sf_road_travel',
size_bins_style('auto_speed'),
legends=size_bins_legend(
title='Road Congestion',
description='Travel Speeds',
footer='Data: City of SF',
format='d'
)
)
Out[2]: