MCPcopy Index your code
hub / github.com/pydata/xarray / map_dataarray_line

Method map_dataarray_line

xarray/plot/facetgrid.py:614–654  ·  view source on GitHub ↗
(
        self: T_FacetGrid,
        func: Callable,
        x: Hashable | None,
        y: Hashable | None,
        hue: Hashable | None,
        add_legend: bool = True,
        _labels=None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

612 return self
613
614 def map_dataarray_line(
615 self: T_FacetGrid,
616 func: Callable,
617 x: Hashable | None,
618 y: Hashable | None,
619 hue: Hashable | None,
620 add_legend: bool = True,
621 _labels=None,
622 **kwargs: Any,
623 ) -> T_FacetGrid:
624 from xarray.plot.dataarray_plot import _infer_line_data
625
626 for d, ax in zip(self.name_dicts.flat, self.axs.flat, strict=True):
627 # None is the sentinel value
628 if d is not None:
629 subset = self.data.loc[d]
630 mappable = func(
631 subset,
632 x=x,
633 y=y,
634 ax=ax,
635 hue=hue,
636 add_legend=False,
637 _labels=False,
638 **kwargs,
639 )
640 self._mappables.append(mappable)
641
642 xplt, yplt, hueplt, huelabel = _infer_line_data(
643 darray=self.data.loc[self.name_dicts.flat[0]], x=x, y=y, hue=hue
644 )
645 xlabel = label_from_attrs(xplt)
646 ylabel = label_from_attrs(yplt)
647
648 self._hue_var = hueplt
649 self._finalize_grid(xlabel, ylabel)
650
651 if add_legend and hueplt is not None and huelabel is not None:
652 self.add_legend(label=huelabel)
653
654 return self
655
656 def map_dataset(
657 self: T_FacetGrid,

Callers 1

_easy_facetgridFunction · 0.95

Calls 5

_finalize_gridMethod · 0.95
add_legendMethod · 0.95
_infer_line_dataFunction · 0.90
label_from_attrsFunction · 0.90
funcFunction · 0.50

Tested by

no test coverage detected