Neater way to use subplots?
3 views (last 30 days)
Show older comments
Recently, I have been using matlab for data analysis. When using subplots to compare multiple graphs at once, I have run into the problem wherein the plots look a bit sloppy when using 3 or more plots. Just for the problem's sake, I will use the variables:
a=1:5;
b=1:5;
c=1:10;
d=1:10;
e=5:15;
f=5:15;
The plots for these would be:
>> figure(1)
subplot(2,2,1)
plot(a,b)
hold on
subplot(2,2,2)
plot(c,d)
subplot(2,2,3.5)
plot(e,f)
I would like the bottom graph to be larger, potentially spanning the entire bottom of the display space. I thought changing the (m,n) variables in the subplot command would help, but it only leads to a jumbled up graph. Any advice here would be great
0 Comments
Accepted Answer
Star Strider
on 14 Feb 2015
It may be experiencing indigestion with the fractional reference. Consider using the 'Position' option instead.
3 Comments
Star Strider
on 14 Feb 2015
My pleasure!
There are also many of posts on ‘Answers’ dealing with the intricacies of getting subplots to look just the way you want them to. I haven’t seen many recently, but I’ve answered a few in the past.
dpb
on 14 Feb 2015
If wants the top two separate and the bottom to cover the positions of both lower as a single, then the answer is trivial as showed--
subplot(2,2,3:4)
This is documented and gives examples. Can also use contiguous elements vertically for the LH or RH sides--
subplot(2,2,[1 3])
is the two LH positions as one.
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!