MCPcopy
hub / github.com/pydata/xarray / _determine_guide

Function _determine_guide

xarray/plot/utils.py:1682–1711  ·  view source on GitHub ↗
(
    hueplt_norm: _Normalize,
    sizeplt_norm: _Normalize,
    add_colorbar: bool | None = None,
    add_legend: bool | None = None,
    plotfunc_name: str | None = None,
)

Source from the content-addressed store, hash-verified

1680
1681
1682def _determine_guide(
1683 hueplt_norm: _Normalize,
1684 sizeplt_norm: _Normalize,
1685 add_colorbar: bool | None = None,
1686 add_legend: bool | None = None,
1687 plotfunc_name: str | None = None,
1688) -> tuple[bool, bool]:
1689 if plotfunc_name == "hist":
1690 return False, False
1691
1692 if (add_colorbar) and hueplt_norm.data is None:
1693 raise KeyError("Cannot create a colorbar when hue is None.")
1694 if add_colorbar is None:
1695 if hueplt_norm.data is not None:
1696 add_colorbar = True
1697 else:
1698 add_colorbar = False
1699
1700 if add_legend and hueplt_norm.data is None and sizeplt_norm.data is None:
1701 raise KeyError("Cannot create a legend when hue and markersize is None.")
1702 if add_legend is None:
1703 if (
1704 not add_colorbar
1705 and (hueplt_norm.data is not None and hueplt_norm.data_is_numeric is False)
1706 ) or sizeplt_norm.data is not None:
1707 add_legend = True
1708 else:
1709 add_legend = False
1710
1711 return add_colorbar, add_legend
1712
1713
1714def _add_legend(

Callers 2

newplotfuncFunction · 0.90
map_plot1dMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…