Answer to "How to distribute subplots to two figures?" gives strange errors?
2 views (last 30 days)
Show older comments
Answer by Matt Fig on 25 Sep 2012 Edited by Matt Fig on 25 Sep 2012
% First the subplots
figure
s(1) = subplot(1,2,1);
plot(1:10)
s(2) = subplot(1,2,2);
ezplot('x.^2')
% Now move them.
figure
set(s(1),'parent',gcf,'pos',[.1 .1 .8 .8])
figure
set(s(2),'parent',gcf,'pos',[.1 .1 .8 .8])
when run gives
"unexpected Matlab expression" in line
"set(s(1),'parent',gcf,'pos',[.1 .1 .8 .8])"
columns 20, and 34 ( twice ) but no error for next line
"set(s(2),'parent',gcf,'pos',[.1 .1 .8 .8])".
Also, what format for more than two ( nine ) subplots split 6 plots x 3 rows and 3 plots x 2 rows, or 4 plots x 2 rows and 5 plots x 3 rows?
1 Comment
Jonathan Epperl
on 12 Feb 2013
Code works fine for me (Matlab 2012b, Win7 64bit), what version are you using? Maybe you're copy-pasting a few characters too few or many?
This
Also, what format for more than two ( nine ) subplots split 6 plots x 3 rows and 3 plots x 2 rows, or 4 plots x 2 rows and 5 plots x 3 rows?
you'll have to rephrase, it's not clear to me what you actually want to know, the syntax for subplot maybe? If so:
subplot(number of rows of subplot, number of columns of subplots, number of the subplot you'll be plotting into )
The subplots are counted like matrices, i.e. along columns, then rows:
| 1 3 5 etc...
| 2 4 6
Answers (0)
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!