default subplot width sizing ('OuterPosition') unequal

10 vues (au cours des 30 derniers jours)
baice
baice le 27 Avr 2017
Modifié(e) : baice le 28 Avr 2017
I am trying to produce and resize 3 subplots within a figure. I usually increase the size and move the plots closer together using the axes 'position' (though I have tried using 'OuterPosition' too). It seems that the default 'OuterPosition' width values are not the same for subplots (3,1,1-3) (or others, though I haven't noticed this before). This is causing me problems for resizing. I have checked and it seems to be the initial default values produced by Matlab No titles, lables or anything). How can I make sure the 3 subplots are exactly the same size before I start resizing? (If I adjust 'OuterPosition', then it messes up 'Position'). I eventually need to match the DataAspectRatio, etc for the plots, and have to be careful what order I do axis equal, limits, etc.
Thank you.

Réponses (1)

Jan
Jan le 27 Avr 2017
The OuterPosition and Position influence each other. For the OuterPosition the sizes of the axes and tick labels matter. If 3 subplots have the same labels, tick marks and Positions, they have the same OuterPositions also.
The only way to make sure, that the 3 axes have the sme size is to defined them with the same size - while "size" can mean the Position or OuterPosition, as you want. But this answer sound trivial, therefore I assume, that I did not understand the problem. What exactly is your question? Maybe a screenshot is useful here.
  1 commentaire
baice
baice le 28 Avr 2017
Modifié(e) : baice le 28 Avr 2017
I seem to have got the sizing to work now (doing everything manually, rather than functions) - but I think the problem related to the default 'outerposition' sizing (as well as using axis equal and changing axis limits, just a weird combination I think). For example, if you run:
figure
S1=subplot(1,3,1);
S2=subplot(1,3,2);
S3=subplot(1,3,3);
get(S1,'position')
get(S1,'Outerposition')
get(S2,'position')
get(S2,'Outerposition')
get(S3,'position')
get(S3,'Outerposition')
you can see the 'outerposition' widths of the subplots are different from each other - even though the labels, etc are all exactly the same. Do you know why this is? Thank you.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by