default size figures with subplot

15 visualizaciones (últimos 30 días)
Kamuran
Kamuran el 19 de Mayo de 2015
Comentada: Kamuran el 20 de Mayo de 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

Respuesta aceptada

Joseph Cheng
Joseph Cheng el 19 de Mayo de 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 comentarios
Joseph Cheng
Joseph Cheng el 19 de Mayo de 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 el 20 de Mayo de 2015
Thanks :)

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by