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

# plhist(3plplot)

Plot a histogram from unbinned data

## NAME

**plhist** - Plot a histogram from unbinned data

## SYNOPSIS

**plhist**(*n*, *data*, *datmin*, *datmax*, *nbin*, *opt*)

## DESCRIPTION

Plots a histogram from *n* data points stored in the *data* vector.  This routine bins the data into *nbin* bins equally spaced between *datmin* and *datmax*, and calls [**plbin**(3plplot)](/plbin/3plplot.md) to draw the resulting histogram.  Parameter *opt* allows, among other things, the histogram either to be plotted in an existing window or causes [**plhist**(3plplot)](/plhist/3plplot.md) to call [**plenv**(3plplot)](/plenv/3plplot.md) with suitable limits before plotting the histogram.

Redacted form: **plhist(data, datmin, datmax, nbin, opt)**

This function is used in example 5.

## ARGUMENTS

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

  Number of data points.

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

  A vector containing the values of the *n* data points.

- *datmin* (**PLFLT**(3plplot), input)

  Left-hand edge of lowest-valued bin.

- *datmax* (**PLFLT**(3plplot), input)

  Right-hand edge of highest-valued bin.

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

  Number of (equal-sized) bins into which to divide the interval *xmin* to *xmax*.

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

  Is a combination of several flags: *opt*=PL\_HIST\_DEFAULT: The axes are automatically rescaled to fit the histogram data, the outer bins are expanded to fill up the entire x-axis, data outside the given extremes are assigned to the outer bins and bins of zero height are simply drawn. *opt*=PL\_HIST\_NOSCALING\|...: The existing axes are not rescaled to fit the histogram data, without this flag, [**plenv**(3plplot)](/plenv/3plplot.md) is called to set the world coordinates. *opt*=PL\_HIST\_IGNORE\_OUTLIERS\|...: Data outside the given extremes are not taken into account. This option should probably be combined with *opt*=PL\_HIST\_NOEXPAND\|..., so as to properly present the data. *opt*=PL\_HIST\_NOEXPAND\|...: The outer bins are drawn with equal size as the ones inside. *opt*=PL\_HIST\_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.
