Note: You need to have the folium
package installed to run this notebook.
A Munro (About this sound listen (help·info)) is a mountain in Scotland with a height over 3,000 feet (914 m). Munros are named after Sir Hugh Munro, 4th Baronet (1856–1919), who produced the first list of such hills, known as Munro's Tables, in 1891... says Wikipedia, more in https://en.wikipedia.org/wiki/Munro.
Let's show the possibility to plot histograms in the maps with the help of folium library.
# Necessary import evil
import physt.plotting
physt.plotting.set_default_backend("folium")
# Read the data
from physt.examples import load_dataset
munros = load_dataset("munros")
munros.head()
name | height | long | lat | |
---|---|---|---|---|
0 | Ben Nevis | 1344.0 | -5.003526 | 56.796834 |
1 | Ben Macdui [Beinn Macduibh] | 1309.0 | -3.669100 | 57.070386 |
2 | Braeriach | 1296.0 | -3.728581 | 57.078177 |
3 | Cairn Toul | 1291.0 | -3.710790 | 57.054415 |
4 | Sgor an Lochain Uaine | 1258.0 | -3.725797 | 57.058378 |
# How many of them are there? Wikipedia says 282 (as of 2017)
munros.shape
(282, 4)
hist = physt.h2(munros["lat"], munros["long"], "fixed_width", bin_width=1 / 6)
map = hist.plot()
map
# Now, let's combine this information with positions of the 20 tallest
import folium
map = hist.plot()
for i, row in munros.iloc[:20].iterrows():
marker = folium.Marker([row["lat"], row["long"]], popup="{0} ({1} m)".format(row["name"], row["height"]))
marker.add_to(map)
map