Wednesday, March 30, 2011

Matlab Subplot Example Histograms

This is a subplot example with histograms
%I. Start
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear

load RayData
%A         110x4              3520  double   

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%{
%1. horse 1
i=1;
figure(i)
%now plot
hist(A(:,1))

%2. use X in other ones
i=2;
figure(i)
hist(A(:,2))

%3. Figure 3
i=3;
figure(i)
hist(A(:,3))


%4. Figure 4
i=4;
figure(i)
hist(A(:,4))
%}

%Part II. Plot in single subplot
%-----------------------------------------

%Basic Example
%{
figure;
subplot(1,2,1); plot(count(:))
subplot(1,2,2); hist(count(:),5)
datacursormode on

top row (left to right)
>> subplot(2,2,1)
>> subplot(2,2,2)

bottom row (left to right)
>> subplot(2,2,3)
>> subplot(2,2,4)


%}
figure(1);
subplot(2,2,1);  hist(A(:,1)); xlabel('Horse 1', 'fontsize', 16);

subplot(2,2,2); hist(A(:,2)); xlabel('Horse 2', 'fontsize', 16);
subplot(2,2,3); hist(A(:,3)); xlabel('Horse 3', 'fontsize', 16);
subplot(2,2,4); hist(A(:,4)); xlabel('Horse 4', 'fontsize', 16);

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.