Filter löschen
Filter löschen

default size figures with subplot

6 Ansichten (letzte 30 Tage)
Kamuran
Kamuran am 19 Mai 2015
Kommentiert: Kamuran am 20 Mai 2015
I would like to combine couple or three figures into a single window but when I use subplot(2,1,1) and subplot(2,1,2) I get two long ones or subplot(1,2,1) and subplot(1,2,2) I get two tall ones. I just want two figures side by side with their default size.
Is that possible? if so, how ? :D
Thanks

Akzeptierte Antwort

Joseph Cheng
Joseph Cheng am 19 Mai 2015
yeah very simple.
hfig = figure;
pos = get(hfig,'position')
set(hfig,'position',pos.*[.5 1 2 1])
subplot(1,2,1),plot(randi(10,10,2))
subplot(1,2,2),plot(randi(10,10,2))
  2 Kommentare
Joseph Cheng
Joseph Cheng am 19 Mai 2015
well some additional playing around with it like
numplots = 4;
hfig = figure;
pos = get(hfig,'position')
set(hfig,'position',pos.*[0 1 numplots 1])
for ind = 1:numplots
subplot(1,numplots,ind),plot(randi(10,10,2))
end
does show there is some width modifications to the width of each axes, especially the more you put in. However the heights are the same. You can play around with the set() command for both the figure handle and axes handles to change their positioning if this slight change from the default size is an issue.
Kamuran
Kamuran am 20 Mai 2015
Thanks :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by