morebins

Increases the number of bins of an existing histogram object.

Category: Graphics > 2-D and 3-D Plots

Syntax

morebins(h)

Makes the histogram h use more, narrower bins.

n = morebins(h)

Also returns the new number of bins.

Description

The binning of h is changed in place and the figure is redrawn with finer bins. Each call raises the bin count by one step, so it can be repeated until the detail you want shows. fewerbins does the opposite.

Input arguments

h
Histogram object created by histogram.

Output arguments

n
Number of bins after the change.

Example

Finer bins

h = histogram(1:100);
before = h.NumBins
after = morebins(h)
Output
before = 5
after = 6

See also

fewerbins histogram histcounts hist