I am trying to make subplots using the grouped scatterhist
function in matlab.
subplot(2,2,1)
scatterhist(x,y,\'Group\',factor)
subplot(2,2,2)
scat
scatterhist
doesn't interact well with subplot
, so you have to find ways around that.
Here is a way of doing it with uipanel
.
% create two separate figures with the two scatterplots in
h1 = figure
scatterhist(x,y,'Group',factor)
h2 = figure
scatterhist(x,y,'Group',factor)
% create third figure split into two uipanels
h3 = figure
u1 = uipanel('position',[0,0,0.5,1]);
u2 = uipanel('position',[0.5,0,0.5,1);
% get all children from each figure and move to the uipanels
set(get(h1,'Children'),'parent',u1);
set(get(h2,'Children'),'parent',u2);
%close unneeded figures
close(h1,h2)
If you wanted to do a lot of these, you might want to create a function that works out the right position
values depending on how many subplots you want in the figure.