{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import hvplot.xarray # noqa" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Similar to [`image`](image.ipynb), `contourf` displays values on a 2d grid. But it first segments data into various levels." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "\n", "ds = xr.tutorial.open_dataset('air_temperature')\n", "ds" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ds.hvplot.contourf()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There are lots of options exposed to control the style and contents of the `contourf` plot:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ds.mean(dim='time').hvplot.contourf(z='air', x='lon', y='lat', levels=20,\n", " clabel='T [K]', label='Mean Air temperature [K]',\n", " cmap='fire')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Geographic Data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ds.hvplot.contourf(levels=20, geo=True, coastline=True, widget_location='left_top')" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 4 }