Skip to content

Instantly share code, notes, and snippets.

@giswqs
Created April 27, 2022 13:04
Show Gist options
  • Save giswqs/e6d4bd03250f489e9c1b5a8872ccf60c to your computer and use it in GitHub Desktop.
Save giswqs/e6d4bd03250f489e9c1b5a8872ccf60c to your computer and use it in GitHub Desktop.
choropleth maps
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true
},
"id": "2f91ffa6-0819-4718-b376-c0b351d04e31",
"cell_type": "code",
"source": "import leafmap",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"id": "02460c7d-e507-46f9-aa1c-d1519c065c04",
"cell_type": "code",
"source": "data = leafmap.examples.datasets.countries_geojson",
"execution_count": 2,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"id": "5561efa0-39b3-4722-bac4-609fc415a446",
"cell_type": "code",
"source": "m = leafmap.Map()\nm.add_data(data, column='POP_EST', scheme='Quantiles', cmap='Blues', legend_title='Population')\nm",
"execution_count": 3,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "3a7f4ccf7a244815b15a37bcf9658b81"
}
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"id": "2bf02d2d-b97e-440d-bf31-ffbc32f9eee2",
"cell_type": "code",
"source": "m = leafmap.Map()\nm.add_data(data, column='POP_EST', scheme='EqualInterval', cmap='Blues', legend_title='Population')\nm",
"execution_count": 4,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "3ab0ee4af0ae4a6fbae1e50096706fed"
}
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"id": "79406657-1517-447f-b179-e5d477d02cdb",
"cell_type": "code",
"source": "m = leafmap.Map()\nm.add_data(data, column='POP_EST', scheme='FisherJenks', cmap='Blues', legend_title='Population')\nm",
"execution_count": 5,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "abaf8eaeb96b4c5d9708537723b22e90"
}
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"id": "e4c1907c-474e-4328-ae4b-75b04f7a6a24",
"cell_type": "code",
"source": "m = leafmap.Map()\nm.add_data(data, column='POP_EST', scheme='JenksCaspall', cmap='Blues', legend_title='Population')\nm",
"execution_count": 6,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "fea56d54f90c4fb0b9a0c17eee2531de"
}
},
"metadata": {}
}
]
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.9.10",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"hide_input": false,
"varInspector": {
"window_display": false,
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"library": "var_list.py",
"delete_cmd_prefix": "del ",
"delete_cmd_postfix": "",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"library": "var_list.r",
"delete_cmd_prefix": "rm(",
"delete_cmd_postfix": ") ",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
]
},
"toc": {
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"base_numbering": 1,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"gist": {
"id": "",
"data": {
"description": "choropleth maps",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment