hvPlot 0.10 has just been released! Checkout the blog post and support hvPlot by giving it a 🌟 on Github.

Contour#

import hvplot.xarray  # noqa

Similar to image, contour displays values on a 2d grid. But it first segments data into various levels.

import xarray as xr

ds = xr.tutorial.open_dataset('air_temperature')
ds
<xarray.Dataset> Size: 31MB
Dimensions:  (lat: 25, time: 2920, lon: 53)
Coordinates:
  * lat      (lat) float32 100B 75.0 72.5 70.0 67.5 65.0 ... 22.5 20.0 17.5 15.0
  * lon      (lon) float32 212B 200.0 202.5 205.0 207.5 ... 325.0 327.5 330.0
  * time     (time) datetime64[ns] 23kB 2013-01-01 ... 2014-12-31T18:00:00
Data variables:
    air      (time, lat, lon) float64 31MB ...
Attributes:
    Conventions:  COARDS
    title:        4x daily NMC reanalysis (1948)
    description:  Data is from NMC initialized reanalysis\n(4x/day).  These a...
    platform:     Model
    references:   http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly...
ds.hvplot.contour()

There are lots of options exposed to control the style and contents of the contour plot:

ds.mean(dim='time').hvplot.contour(z='air', x='lon', y='lat', levels=20, 
                                   clabel='T [K]', label='Mean Air temperature [K]',
                                   cmap='gray')

Geographic Data#

Include a basemap from a tiling service using the tiles option.

ds.hvplot.contour(geo=True, tiles='EsriImagery', levels=20, line_width=2, cmap='reds',)