Skip to content

Commit 2c36fff

Browse files
authored
Merge pull request #423 from martinRenou/clean_geodata_hover_example
Clean GeoData on_hover Notebook
2 parents 5fd3c5f + 0d3c8e2 commit 2c36fff

File tree

1 file changed

+7
-32
lines changed

1 file changed

+7
-32
lines changed

examples/GeoData_on_hover.ipynb

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
{
44
"cell_type": "code",
55
"execution_count": null,
6-
"metadata": {
7-
"scrolled": false
8-
},
6+
"metadata": {},
97
"outputs": [],
108
"source": [
119
"from ipyleaflet import Map, GeoData, basemaps, LayersControl\n",
@@ -37,10 +35,7 @@
3735
"from ipyleaflet import WidgetControl, GeoJSON \n",
3836
"\n",
3937
"\n",
40-
"html = HTML('''\n",
41-
" <h4> population density</h4>\n",
42-
" Hover over a state\n",
43-
"''')\n",
38+
"html = HTML('''Hover over a state''')\n",
4439
"html.layout.margin = '0px 20px 20px 20px'\n",
4540
"control = WidgetControl(widget=html, position='topright')\n",
4641
"m.add_control(control)"
@@ -54,35 +49,15 @@
5449
"source": [
5550
"def update_html(feature, **kwargs):\n",
5651
" html.value = '''\n",
57-
" <h5>Population density</h5>\n",
58-
" <h5><b>{}</b></h5>\n",
59-
" {} people \n",
60-
" <h5><b> Continent : {} </b></h5>\n",
61-
" <h15> GDP : {} </h15> \n",
52+
" <h3><b>{}</b></h3>\n",
53+
" <h4>Population: {:.2e} people</h4> \n",
54+
" <h4>Continent: {}</h4>\n",
6255
" '''.format(feature['properties']['name'],\n",
6356
" feature['properties']['pop_est'],\n",
64-
" feature['properties']['continent'],\n",
65-
" feature['properties']['gdp_md_est'])\n",
57+
" feature['properties']['continent'])\n",
6658
"\n",
6759
"geo_data.on_hover(update_html)"
6860
]
69-
},
70-
{
71-
"cell_type": "code",
72-
"execution_count": null,
73-
"metadata": {},
74-
"outputs": [],
75-
"source": [
76-
"from ipyleaflet import FullScreenControl, LayersControl\n",
77-
"m.add_control(FullScreenControl())"
78-
]
79-
},
80-
{
81-
"cell_type": "code",
82-
"execution_count": null,
83-
"metadata": {},
84-
"outputs": [],
85-
"source": []
8661
}
8762
],
8863
"metadata": {
@@ -105,5 +80,5 @@
10580
}
10681
},
10782
"nbformat": 4,
108-
"nbformat_minor": 2
83+
"nbformat_minor": 4
10984
}

0 commit comments

Comments
 (0)