block by ResidentMario 868ac097d671df1ed5ec83eed048560c

Custom KDEPlot webmap

Full Screen

This webmap demonstates the result of using the geoplot and mplleaflet Python libraries to generate a simple HTML webmap. It was created with the following code:

# Load the data (uses the `quilt` package).
from quilt.data.ResidentMario import geoplot_data
import geopandas as gpd
listings = gpd.read_file(geoplot_data.boston_airbnb_listings())


# Plot the data.
import geoplot as gplt
import matplotlib.pyplot as plt
import mplleaflet

ax = gplt.kdeplot(listings)

fig = plt.gcf()
with open("boston-airbnb-kde.html", 'w') as f:
    f.write(
        mplleaflet.fig_to_html(
            fig, tiles=('http://{s}.tile.openstreetmap.se/hydda/base/{z}/{x}/{y}.png',
                        'Tiles courtesy of <a href="http://openstreetmap.se/" target="_blank">'
                        'OpenStreetMap Sweden</a> &mdash; Map data &copy; '
                        '<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
                        )
        )
    )