---
name: "plbin"
section: "3plplot"
platform: "linux"
package: "plplot-doc"
version: "5.15.0+dfsg2-15"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/plbin"
---

# plbin(3plplot)

Plot a histogram from binned data

## NAME

**plbin** - Plot a histogram from binned data

## SYNOPSIS

**plbin**(*nbin*, *x*, *y*, *opt*)

## DESCRIPTION

Plots a histogram consisting of *nbin* bins.  The value associated with the i'th bin is placed in *x*\[i\], and the number of points in the bin is placed in *y*\[i\].  For proper operation, the values in *x*\[i\] must form a strictly increasing sequence.  By default, *x*\[i\] is the left-hand edge of the i'th bin. If *opt*=PL\_BIN\_CENTRED is used, the bin boundaries are placed midway between the values in the *x* vector.  Also see [**plhist**(3plplot)](/plhist/3plplot.md) for drawing histograms from unbinned data.

Redacted form: General: **plbin(x, y, opt)** Python: **plbin(nbin, x, y, opt)**

This function is not used in any examples.

## ARGUMENTS

- *nbin* (**PLINT**(3plplot), input)

  Number of bins (i.e., number of values in *x* and *y* vectors.)

- *x* (**PLFLT\_VECTOR**(3plplot), input)

  A vector containing values associated with bins.  These must form a strictly increasing sequence.

- *y* (**PLFLT\_VECTOR**(3plplot), input)

  A vector containing a number which is proportional to the number of points in each bin.  This is a PLFLT (instead of PLINT) vector so as to allow histograms of probabilities, etc.

- *opt* (**PLINT**(3plplot), input)

  Is a combination of several flags: *opt*=PL\_BIN\_DEFAULT: The *x* represent the lower bin boundaries, the outer bins are expanded to fill up the entire x-axis and bins of zero height are simply drawn. *opt*=PL\_BIN\_CENTRED\|...: The bin boundaries are to be midway between the *x* values. If the values in *x* are equally spaced, the values are the center values of the bins. *opt*=PL\_BIN\_NOEXPAND\|...: The outer bins are drawn with equal size as the ones inside. *opt*=PL\_BIN\_NOEMPTY\|...: Bins with zero height are not drawn (there is a gap for such bins).

## AUTHORS

Many developers (who are credited at http://plplot.org/credits.php) have contributed to PLplot over its long history.

## SEE ALSO

PLplot documentation at http://plplot.org/documentation.php.
