We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa37607 commit 813bebcCopy full SHA for 813bebc
xarray/plot/facetgrid.py
@@ -8,7 +8,7 @@
8
from .utils import (
9
_infer_xy_labels, _process_cmap_cbar_kwargs, import_matplotlib_pyplot,
10
label_from_attrs)
11
-
+import xarray as xr
12
# Overrides axes.labelsize, xtick.major.size, ytick.major.size
13
# from mpl.rcParams
14
_FONTSIZE = 'small'
@@ -337,9 +337,13 @@ def _finalize_grid(self, *axlabels):
337
self._finalized = True
338
339
def add_legend(self, **kwargs):
340
+ if isinstance(self._hue_var, xr.DataArray):
341
+ labels = self._hue_var.values
342
+ else:
343
+ labels = self._hue_var
344
figlegend = self.fig.legend(
345
handles=self._mappables[-1],
- labels=list(self._hue_var.values),
346
+ labels=list(labels),
347
title=self._hue_label,
348
loc="center right", **kwargs)
349
0 commit comments