| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Statistics Toolbox |
| Contents | Index |
| Learn more about Statistics Toolbox |
scatterhist(x,y)
scatterhist(x,y,nbins)
h = scatterhist(...)
scatterhist(x,y) creates a 2-D scatterplot of the data in the vectors x and y, and puts a univariate histogram on the horizontal and vertical axes of the plot. x and y must be the same length.
The function is useful for viewing properties of random samples produced by functions such as copularnd, mvnrnd, lhsdesign.
scatterhist(x,y,nbins) also accepts a two-element vector nbins specifying the number of bins for the x and y histograms. The default is to compute the number of bins using a Scott rule based on the sample standard deviation. Any NaN values in either x or y are treated as missing, and are removed from both x and y. Therefore the plots reflect points for which neither x nor y has a missing value.
h = scatterhist(...) returns a vector of three axes handles for the scatterplot, the histogram along the horizontal axis, and the histogram along the vertical axis, respectively.
Independent normal and lognormal random samples:
x = randn(1000,1); y = exp(.5*randn(1000,1)); scatterhist(x,y)

Marginal uniform samples that are not independent:
u = copularnd('Gaussian',.8,1000);
scatterhist(u(:,1),u(:,2))

Mixed discrete and continuous data:
cars = load('carsmall');
scatterhist(cars.Weight,cars.Cylinders,[10 3])

![]() | sampsizepwr | scramble (qrandset) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |