From aade3b23a2c4a8101cf905ab93db9afe34c38d89 Mon Sep 17 00:00:00 2001 From: Illviljan <14371165+Illviljan@users.noreply.github.com> Date: Sat, 30 Jan 2021 16:56:05 +0100 Subject: [PATCH] Add units if "unit" is in the attrs. --- xarray/plot/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xarray/plot/utils.py b/xarray/plot/utils.py index 16c67e154fc..601b23a3065 100644 --- a/xarray/plot/utils.py +++ b/xarray/plot/utils.py @@ -460,6 +460,8 @@ def label_from_attrs(da, extra=""): if da.attrs.get("units"): units = " [{}]".format(da.attrs["units"]) + elif da.attrs.get("unit"): + units = " [{}]".format(da.attrs["unit"]) else: units = ""