{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import hvplot.pandas # noqa" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Using hvplot with geopandas is as simple as loading a geopandas dataframe and calling `hvplot` on it with `geo=True`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import geopandas as gpd\n", "\n", "cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))\n", "cities.sample(5)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cities.hvplot(geo=True, tiles=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can easily change the tiles, add coastlines, or which fields show up in the hover text:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cities.hvplot(tiles='EsriTerrain', coastline=True, hover_cols='all')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can also alter the projection of the data using cartopy:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import cartopy.crs as ccrs" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cities.hvplot(coastline=True, projection=ccrs.Geostationary(central_longitude=-30), global_extent=True)" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 4 }