plotnine.stat_bin

stat_bin(mapping=None, data=None, **kwargs)

Count cases in each interval

{usage}

Parameters

binwidth : float = None

The width of the bins. The default is to use bins bins that cover the range of the data. You should always override this value, exploring multiple widths to find the best to illustrate the stories in your data.

bins : int = None

Number of bins. Overridden by binwidth. If None, a number is computed using the freedman-diaconis method.

breaks : array_like = None

Bin boundaries. This supersedes the binwidth, bins, center and boundary.

center : float = None

The center of one of the bins. Note that if center is above or below the range of the data, things will be shifted by an appropriate number of widths. To center on integers, for example, use width=1 and center=0, even if 0 i s outside the range of the data. At most one of center and boundary may be specified.

boundary : float = None

A boundary between two bins. As with center, things are shifted when boundary is outside the range of the data. For example, to center on integers, use width=1 and boundary=0.5, even if 1 is outside the range of the data. At most one of center and boundary may be specified.

closed : Literal[left, right] = "right"

Which edge of the bins is included.

pad : bool = False

If True, adds empty bins at either side of x. This ensures that frequency polygons touch 0.

See Also

histogram

The default geom for this stat.