{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Size bins legend\n",
"\n",
"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.\n",
"\n",
"To view available legend parameters, run `help(size_bins_legend)`\n",
"\n",
"In this example, the size bins legend reads from the `size` property to draw a classed legend of travel speeds with ranges labeled."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from cartoframes.auth import set_default_credentials\n",
"\n",
"set_default_credentials('cartoframes')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from cartoframes.viz import Layer, size_bins_style, size_bins_legend\n",
"\n",
"Layer(\n",
" 'sf_road_travel',\n",
" size_bins_style('auto_speed'),\n",
" legends=size_bins_legend(\n",
" title='Road Congestion',\n",
" description='Travel Speeds',\n",
" footer='Data: City of SF',\n",
" format='d'\n",
" )\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}