import hvplot.xarray # noqa
import xarray as xr
ds = xr.tutorial.open_dataset('air_temperature')
ds
When data values are available on an x, y grid, they can often be represented as an image
.
ds.hvplot.image()
This is equivalent to specifying:
ds.hvplot.image(x='lon', y='lat', z='air', groupby='time', cmap='kbc_r')
A simpler case would be to take the temperature at just one day. Here we'll show how to use clabel
to control the colorbar and also demonstrate how when the data are symmetric around 0, the "coolwarm" colormap is used by default.
time = '2014-01-01'
data = ds.sel(time=time).mean('time') - 273 # convert to celcius
data.hvplot.image(x='lon', y='lat', z='air', title=time, clabel='T [C]')
By setting coastline=True
, we can add a coastline feature to the plot and coerce it to the proper aspect.
data.hvplot.image(coastline=True)