-
-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Folium reference notebook (#2672)
* add Folium reference * clean up notebook * Fix typo * clear notebook
- Loading branch information
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"source": [ | ||
"import folium\n", | ||
"import panel as pn\n", | ||
"\n", | ||
"pn.extension(sizing_mode=\"stretch_width\")" | ||
], | ||
"outputs": [], | ||
"metadata": {} | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"The ``Folium`` pane renders [folium](http://python-visualization.github.io/folium/) interactive maps.\n", | ||
"\n", | ||
"#### Parameters:\n", | ||
"\n", | ||
"For layout and styling related parameters see the [customization user guide](../../user_guide/Customization.ipynb).\n", | ||
"\n", | ||
"* **``object``** (object): The Folium object being displayed\n", | ||
"___" | ||
], | ||
"metadata": {} | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"The `Folium` pane uses the built-in HTML representation provided by `folium` to render the map:" | ||
], | ||
"metadata": {} | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"source": [ | ||
"m = folium.Map(location=[52.51, 13.39], zoom_start=12)\n", | ||
"\n", | ||
"folium_pane = pn.pane.plot.Folium(m, height=400)\n", | ||
"\n", | ||
"folium_pane" | ||
], | ||
"outputs": [], | ||
"metadata": {} | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"Like any other pane, the `Folium` pane's view can be updated by setting the `object` parameter:" | ||
], | ||
"metadata": {} | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"source": [ | ||
"# Add a marker to the map\n", | ||
"folium.Marker(\n", | ||
" [52.516, 13.381], popup=\"<i>Brandenburg Gate</i>\", tooltip=\"Click me!\"\n", | ||
").add_to(m)\n", | ||
"\n", | ||
"folium_pane.object = m" | ||
], | ||
"outputs": [], | ||
"metadata": {} | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python", | ||
"pygments_lexer": "ipython3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |