MATLAB Answers

Subplot position with App Designer

33 views (last 30 days)
Marc Youcef
Marc Youcef on 5 Jun 2019
Commented: Shubham Gupta on 25 Jul 2019
I am using App Designer on MATLAB R2019a and would like to use a subplot to show different images side to side
I read a document here that explains how to set subplots with new version of MATLAB App Designer but the issue I face is regarding the positioning of such subplot.
I have an App with a panel called MyPanel where I want the subplot to appear. According the link above I do :
app.MyPanel.AutoResizeChildren = 'off';
CellAxes{1,1}=subplot(1,2,1,'Parent',app.MyPanel);
This create axes randomly set on MyPanel. Then when I want to change the position of my subplot though 'Position' variable, it changes only position of subplot(1,2,1). Next subplot will not be aligned with the previously set position for subplot(1,2,1).
What I am looking to is to set the first size and position of the subplot and then the next subplot(1,2,2) would align and be beside that previous plot.
In other words, when we call subplot, it creates axes by defaults in a certain position in the figure on which it will align coming subplots. I want to change that initial positiont value and let the subplot continue to do its magic on aligning the next subplots.
Hope it clear enough.

  5 Comments

Show 2 older comments
Marc Youcef
Marc Youcef on 15 Jul 2019
Hi, I did not find a solution I just did sperated plots where I adjusted position of each plot sperately and then put aside the usage of subplot. It is similar that to what SHUBHAM GUPTA mentionned actually.
Thanks.
ZEINA AHDAB
ZEINA AHDAB on 24 Jul 2019
Hi, I am having a similar problem. The 2 subplots created by default are not alined, and one is on top of the other in my case. I didn't want to creat two different plots and use more if loops to control their 'on' 'off' visibilities, which whoud add more processes to the app. I guess it's the only solution I have for now though.
But I believe that so far the information provided by mathworks isn't enough for the user to manage the subplot command. At least it wasnt for me.
I hope it will be made more userfriendly soon.
Shubham Gupta
Shubham Gupta on 25 Jul 2019
@ZEINA AHDAB, can you please share your code with us, so we can understand why exactly your default subplots are not aligned because as far as I know, I haven't seen default subplots behaving like that?
Waiting to hear from you soon !

Sign in to comment.

Answers (0)

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by