| Contents | Index |
scatterhist(x,y)
h = scatterhist(...)
scatterhist(...,'param1',val1,'param2',val2,...)
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.
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.
scatterhist(...,'param1',val1,'param2',val2,...) specifies additional parameter name/values pairs to control how the plot is made. Valid parameters are the following:
'NBins' — A scalar or a two-element vector specifying the number of bins for the X and Y histograms. The default is to compute the number of bins using Scott's rule based on the sample standard deviation.
'Location' — A string controlling the location of the marginal histograms within the figure. 'SouthWest' (the default) plots the histograms below and to the left of the scatterplot, 'SouthEast' plots them below and to the right, 'NorthEast' above and to the right, and 'NorthWest' above and to the left.
'Direction' — A string controlling the directation of the marginal histograms in the figure. 'in' (the default) plots the histograms with bars directed in towards the scatterplot, 'out' plots the histograms with bars directed out away from the scatterplot.
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),'Direction','out')

Mixed discrete and continuous data:
load('carsmall');
scatterhist(Weight,Cylinders,'NBins',[10 3],'Direction','out')

| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |