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

Function hist

xarray/plot/dataarray_plot.py:644–719  ·  view source on GitHub ↗

Histogram of DataArray. Wraps :py:func:`matplotlib:matplotlib.pyplot.hist`. Plots *N*-dimensional arrays by first flattening the array. Parameters ---------- darray : DataArray Can have any number of dimensions. figsize : Iterable of float, optional A

(
    darray: DataArray,
    *,
    figsize: Iterable[float] | None = None,
    size: float | None = None,
    aspect: AspectOptions = None,
    ax: Axes | None = None,
    xincrease: bool | None = None,
    yincrease: bool | None = None,
    xscale: ScaleOptions = None,
    yscale: ScaleOptions = None,
    xticks: ArrayLike | None = None,
    yticks: ArrayLike | None = None,
    xlim: tuple[float, float] | None = None,
    ylim: tuple[float, float] | None = None,
    **kwargs: Any,
)

Source from the content-addressed store, hash-verified

642
643
644def hist(
645 darray: DataArray,
646 *,
647 figsize: Iterable[float] | None = None,
648 size: float | None = None,
649 aspect: AspectOptions = None,
650 ax: Axes | None = None,
651 xincrease: bool | None = None,
652 yincrease: bool | None = None,
653 xscale: ScaleOptions = None,
654 yscale: ScaleOptions = None,
655 xticks: ArrayLike | None = None,
656 yticks: ArrayLike | None = None,
657 xlim: tuple[float, float] | None = None,
658 ylim: tuple[float, float] | None = None,
659 **kwargs: Any,
660) -> tuple[np.ndarray, np.ndarray, BarContainer | Polygon]:
661 """
662 Histogram of DataArray.
663
664 Wraps :py:func:`matplotlib:matplotlib.pyplot.hist`.
665
666 Plots *N*-dimensional arrays by first flattening the array.
667
668 Parameters
669 ----------
670 darray : DataArray
671 Can have any number of dimensions.
672 figsize : Iterable of float, optional
673 A tuple (width, height) of the figure in inches.
674 Mutually exclusive with ``size`` and ``ax``.
675 aspect : "auto", "equal", scalar or None, optional
676 Aspect ratio of plot, so that ``aspect * size`` gives the *width* in
677 inches. Only used if a ``size`` is provided.
678 size : scalar, optional
679 If provided, create a new figure for the plot with the given size:
680 *height* (in inches) of each plot. See also: ``aspect``.
681 ax : matplotlib axes object, optional
682 Axes on which to plot. By default, use the current axes.
683 Mutually exclusive with ``size`` and ``figsize``.
684 xincrease : bool or None, optional
685 Should the values on the *x* axis be increasing from left to right?
686 if ``None``, use the default for the Matplotlib function.
687 yincrease : bool or None, optional
688 Should the values on the *y* axis be increasing from top to bottom?
689 if ``None``, use the default for the Matplotlib function.
690 xscale, yscale : {'linear', 'symlog', 'log', 'logit'}, optional
691 Specifies scaling for the *x*- and *y*-axis, respectively.
692 xticks, yticks : array-like, optional
693 Specify tick locations for *x*- and *y*-axis.
694 xlim, ylim : tuple[float, float], optional
695 Specify *x*- and *y*-axis limits.
696 **kwargs : optional
697 Additional keyword arguments to :py:func:`matplotlib:matplotlib.pyplot.hist`.
698
699 """
700 if darray.ndim == 0 or darray.size == 0:
701 # TypeError to be consistent with pandas

Callers

nothing calls this directly

Calls 7

get_axisFunction · 0.90
label_from_attrsFunction · 0.90
_update_axesFunction · 0.90
histMethod · 0.80
_title_for_sliceMethod · 0.80
to_numpyMethod · 0.45
notnullMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…