The size-continuous
type draws an unclassed legend based on your data's geometry using either the size
(default) or stroke_width
property of your visualization.
To view available legend parameters, run help(size_continuous_legend)
In this example, the size continuous legend reads from the size
property to draw a size legend with representative symbol sizes and the min and max values labeled.
In [1]:
from cartoframes.auth import set_default_credentials
from cartoframes.viz import Layer, size_continuous_style, size_continuous_legend
set_default_credentials('cartoframes')
In [2]:
Layer(
'sf_nbhd_crime',
size_continuous_style('value', size_range=[8,40]),
legends=size_continuous_legend(
title='Crime Counts',
description='by neighborhood',
footer='Source: City of SF',
format='.0s'
)
)
Out[2]: