www.gusucode.com > stats 源码程序 matlab案例代码 > stats/SpecifyBinEdgesForScatterPlotExample.m

    %% Specify Bin Edges for Scatter Plot
% Plot a binned scatter plot of random data with specific bin edges. Use
% bin edges of |Inf| and |-Inf| to capture outliers.
%
% Create a binned scatter plot with 100 bin edges between |[-2 2]| in each
% dimension. The data outside the specified bin edges is not included in
% the plot.
X = tall(randn(1e5,1));
Y = tall(randn(1e5,1));
Xedges = linspace(-2,2);
Yedges = linspace(-2,2);
binScatterPlot(X,Y,Xedges,Yedges)

%%
% Use coarse bins extending to infinity on the edges of the plot to capture
% outliers.
Xedges = [-Inf linspace(-2,2) Inf];
Yedges = [-Inf linspace(-2,2) Inf];
binScatterPlot(X,Y,Xedges,Yedges)