Save figure with all subplots
Mostrar comentarios más antiguos
I generated a lot of figures with subplots. I want to save them and don't want to display them.
I realized only the last subplot is saved. Is there anyway I can save all subplots in a figure.
The following is an example code.
t=linspace(1,10,20);
y=2*t;
for i=1:3
f=figure('visible','off');
subplot(1,3,i)
p=plot(t,y);
saveas(f,'test','jpg')
end
1 comentario
Trang Doan
el 19 de Abr. de 2021
Movida: Adam Danz
el 7 de Oct. de 2024
how to save 1 figure of the subplots
Respuestas (1)
Walter Roberson
el 9 de Oct. de 2019
Construct new file names each iteration.
saveas(f, sprintf('test%d.jpg', i))
4 comentarios
Walter Roberson
el 9 de Oct. de 2019
That would overwrite test.jpg each iteration.
Sharon
el 9 de Oct. de 2019
Adam Danz
el 7 de Oct. de 2024
exportgraphics(fig, filename)
Categorías
Más información sobre Printing and Saving en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!