{ "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", "countries = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))\n", "countries.sample(5)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "countries.hvplot(geo=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Control the color of the elements using the `c` option." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "countries.hvplot.polygons(geo=True, c='pop_est', hover_cols='all')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can even color by another series, such as population density:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "countries.hvplot.polygons(geo=True, c=countries.pop_est/countries.area, clabel='pop density')" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 4 }