Subplot is a convenience function that wraps around the lower level axes function. It simplifies the layout process. As a higher level function, it does some bookkeeping for you. This debugging session shows that the helpful things it does can be confusing if you are not expecting them.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
I just posted a link to that thread. I get the vast majority of my video ideas from questions I get via e-mail. I am glad to see I chose one that is of general interest.
Hi Doug,
I solved the same problem that I encountered in my plotting. As a part of my publication I had to plot 11 figures in the same plot but it is horizontal split not the vertical as you discussed here.
I used the same ‘position’ a little better way giving more space between subplots using
“subplot(‘position’,[x y xlen ylen])” in the for loop.
Your ideas are very tricky and solves the problems more easily.
I would not use subplot like you are. Subplot really just calls axes with a preset position. When you feed the position into subplot, it just gets passed into the axes command anyways. Might as well be more direct.
Doug
Leave a Reply
About
Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.
Salut!
This video shows exactly the problem I solved in MATLAB Central this month :
http://www.mathworks.com/matlabcentral/newsreader/view_thread/296534#796561
Maybe, we now could update this post to inform the user that there is now a video about overlapping of axes?
Aurélien
http://blog.developpez.com/matlab4geek/
@Aurelien,
I just posted a link to that thread. I get the vast majority of my video ideas from questions I get via e-mail. I am glad to see I chose one that is of general interest.
Thanks,
Doug
Hi Doug,
I solved the same problem that I encountered in my plotting. As a part of my publication I had to plot 11 figures in the same plot but it is horizontal split not the vertical as you discussed here.
I used the same ‘position’ a little better way giving more space between subplots using
“subplot(‘position’,[x y xlen ylen])” in the for loop.
Your ideas are very tricky and solves the problems more easily.
Thanks
@Venkata,
I would not use subplot like you are. Subplot really just calls axes with a preset position. When you feed the position into subplot, it just gets passed into the axes command anyways. Might as well be more direct.
Doug