{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Color continuous legend\n",
"\n",
"The `color-continuous` type draws a continuous color legend based on your data's geometry using either the `color` (default) or `strokeColor` property of your visualization.\n",
"\n",
"To view available legend parameters, run `help(color_continuous_legend)`.\n",
"\n",
"In this example, the `color-continuous` legend colors and labels ranges for an unclassed map using the `color` property."
]
},
{
"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": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from cartoframes.viz import Layer, color_continuous_style, color_continuous_legend\n",
"\n",
"Layer(\n",
" 'demographics_sf',\n",
" color_continuous_style('masters_percent'),\n",
" legends=color_continuous_legend(\n",
" title=\"Percent Master's Degree\",\n",
" description='by block group',\n",
" footer='Data: US Census',\n",
" format='.0%'\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.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}