Main Content

Binned scatter plot

`binscatter(`

displays a binned scatter plot for vectors `x`

,`y`

)`x`

and
`y`

. A binned scatter plot partitions the data space into
rectangular bins and displays the count of data points in each bin using different
colors. When zooming into the plot, the bin sizes automatically adjust to show finer
resolution.

`binscatter(___,`

specifies property values with one or more name-value pair arguments. For example,
you can specify `Name,Value`

)`'ShowEmptyBins'`

as `'on'`

to
color areas with no data points. For a full list of properties, see Binscatter Properties. Use this option with any of the input argument
combinations in previous syntaxes.

`binscatter(`

plots
into the axes specified by `ax`

,___)`ax`

instead of into the current axes
(`gca`

). The `ax`

input can precede any of
the input argument combinations in previous syntaxes.

Change the

`ColorScale`

property of the axes to`'log'`

to produce better bin coloring when a few bins dominate the plot.ax = gca; ax.ColorScale = 'log';

`histcounts`

| `histcounts2`

| `histogram`

| `histogram2`

| `scatter`