Categories &

Functions List

Function Reference: scatterhistogram

statistics: scatterhistogram (x, y)

statistics: scatterhistogram (tbl, xvar, yvar)

statistics: scatterhistogram (parent, …)

statistics: scatterhistogram (…, Name, Value)

statistics: h = scatterhistogram (…)

Scatter plot of two samples with the histogram of each along its sides.

scatterhistogram (x, y) draws the points (x(i), y(i)) with a histogram of x above the scatter plot and a histogram of y to its right, each normalized as a probability density, with the bins histcounts chooses. x and y are numeric vectors of the same length; a missing value is left out of the drawing.

scatterhistogram (tbl, xvar, yvar) takes the samples from the variables xvar and yvar of the table tbl, and labels the axes with their names.

With 'GroupData', a vector of categories, text, numbers or logical values with one element for each observation, or 'GroupVariable', a variable of tbl holding them, each group is drawn in a colour of its own, with histograms of its own and a legend naming the groups in the order in which each first appears.

scatterhistogram (parent, …) places the chart in the figure or panel parent rather than the current figure. The chart takes the place of the current axes of its parent, and is refused where hold is on for them.

scatterhistogram (…, Name, Value) sets properties of the chart; see stats.chart.ScatterHistogramChart for all of them, among which 'HistogramDisplayStyle', 'stairs', 'bar' or 'smooth' for a kernel density estimate, 'NumBins', 'BinWidths' and 'ScatterPlotLocation'.

h = scatterhistogram (…) returns the chart, a stats.chart.ScatterHistogramChart object.

See also: stats.chart.ScatterHistogramChart, scatterhist, histcounts, ksdensity

Source Code: scatterhistogram

Two measurements of the same flowers, and how each is spread.

 load fisheriris
 scatterhistogram (meas(:,1), meas(:,2));
 xlabel ('');
plotted figure

Grouped by species, each with its own histograms and colour.

 load fisheriris
 scatterhistogram (meas(:,3), meas(:,4), 'GroupData', species, ...
                   'XLabel', 'Petal length', 'YLabel', 'Petal width');
plotted figure

The same as kernel density estimates, the histograms below and to the left of the scatter plot.

 load fisheriris
 scatterhistogram (meas(:,3), meas(:,4), 'GroupData', species, ...
                   'HistogramDisplayStyle', 'smooth', ...
                   'ScatterPlotLocation', 'NorthEast');
plotted figure