Download this notebook from GitHub (right-click to download).

import hvplot.xarray  # noqa
import xarray as xr


A bar plot represents categorical data with rectangular bars with heights proportional to the numerical values that they represent. The x-axis represents the categories and the y axis represents the numerical value scale. The bars are of equal width which allows for instant comparison of data.


Let’s load some data.

ds = xr.tutorial.open_dataset('air_temperature').load()
air = ds.air
air1d = air.sel(lon=285.,lat=40.).groupby('time.month').mean()
<xarray.DataArray 'air' (month: 12)>
array([272.57443, 272.86398, 275.42163, 282.50516, 288.46164, 293.99957,
       296.62262, 295.0935 , 292.44055, 288.141  , 279.71478, 276.71912],
    lat      float32 40.0
    lon      float32 285.0
  * month    (month) int64 1 2 3 4 5 6 7 8 9 10 11 12
    long_name:     4xDaily Air temperature at sigma level 995
    units:         degK
    precision:     2
    GRIB_id:       11
    GRIB_name:     TMP
    var_desc:      Air temperature
    dataset:       NMC Reanalysis
    level_desc:    Surface
    statistic:     Individual Obs
    parent_stat:   Other
    actual_range:  [185.16 322.1 ]

Basic Bar Plots#'air', height=500, title="Air Temperature by Month")
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.

Download this notebook from GitHub (right-click to download).