www.gusucode.com > stats 源码程序 matlab案例代码 > stats/CreateScatterhistPlotInSpecifiedParentContainerExample.m
%% Create a scatterhist Plot in a Specified Parent Container % % Copyright 2015 The MathWorks, Inc. %% % Load the sample data. Create data vector |x| from the first column of the % data matrix, which contains sepal length measurements from iris flowers. % Create data vector |y| from the second column of the data matrix, which % contains sepal width measurements from the same flowers. load fisheriris x = meas(:,1); y = meas(:,2); %% % Create a new figure and define two uipanel objects to divide the figure % into two parts. In the upper half of the figure, plot the sample data using |scatterhist|. % Include marginal kernel density plots grouped by species. In the lower % half of the figure, plot a histogram of the sepal length measurements % contained in |x|. figure hp1 = uipanel('position',[0 .5 1 .5]); hp2 = uipanel('position',[0 0 1 .5]); scatterhist(x,y,'Group',species,'Parent',hp1); axes('Parent',hp2); hist(x);