Stuart’s MATLAB Videos

Watch and Learn

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Subplot vs axes 4

Posted by Doug Hull,

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.

4 CommentsOldest to Newest

Aurelien Queffurust replied on : 1 of 4
Salut! This video shows exactly the problem I solved in MATLAB Central this month : Maybe, we now could update this post to inform the user that there is now a video about overlapping of axes? Aurélien
dhull replied on : 2 of 4
@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
venkata replied on : 3 of 4
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
dhull replied on : 4 of 4
@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