Multiple subplots (12) - 6 each align
Mostra commenti meno recenti
Hello, I created a figure containing 12 subplots of which 6 each align equally. So I got two "groups" of plots which align equally (group A: 1, 2, 5, 6, 9, 10 and group B: 3,4,7,8,11,12). When using 'position', I had similiar difficulties: the same 6 plots (group A) aligned using a normal vector, the others (group B) used another vector (inches?). What can I do? Plz see the sketch for illustration YES, there are no plots at positions 8 and 12; as stated above and can't be seen on the sketch as I exchanged the plots with white boxes (having a different size) for confidentiality reasons: within the groups A and B the plots align equally;

Any help is appreciated - thank you!
7 Commenti
Cris LaPierre
il 15 Ott 2021
Share your code.
Michael Wernhart
il 15 Ott 2021
Modificato: Michael Wernhart
il 15 Ott 2021
Cris LaPierre
il 15 Ott 2021
Modificato: Cris LaPierre
il 15 Ott 2021
Is the issue in the figure or the saved image?
Try the followig code. Do you still see the issue when running this on your computer?
texttime = "seconds";
hfig=figure('Visible','on');
hfig.Position(3:4)=[1200,600];
pos = get(hfig,'position')
set(hfig,'position',pos.*[.5 1 2 1])
for p = 1:12
ax = subplot(3,4,p);
timeincr = 1:10;
T1 = rand(size(timeincr));
T2 = rand(size(timeincr));
T3 = rand(size(timeincr));
T4 = rand(size(timeincr));
plot(timeincr,T1,'-','Linewidth',2);
hold on;
plot(timeincr,T2,'-.','Linewidth',2)
grid on;
set(ax,'XMinorGrid','on','YMinorGrid','on','XMinorTick','on','YMinorTick','on');
title('Case1')
xlabel(sprintf('Time $\\tau$ in $%s$',texttime),'Interpreter','latex');
ylabel('Temperatures $t_A$ in $^{\circ}C$','Interpreter','latex');
yyaxis right
set(gca,'ycolor','k')
plot(timeincr,T3,':','Linewidth',2)
plot(timeincr,T4,'--','Linewidth',2)
ylabel('Temperatures $t_B$ in $^{\circ}C$','Interpreter','latex');
legend({'$t_{A,1}$','$t_{A,2}$','$t_{B,1}$','$t_{B,2}$'},'Interpreter','latex','Location','best');
end
filename = ['img_' num2str(p)];
pathSaveFilePlots = './';
savefig([pathSaveFilePlots, sprintf('%s_SHX',filename)]);
sprintf('%s.fig saved in %s',filename,pathSaveFilePlots)
figurepath=[pathSaveFilePlots sprintf('%s.emf',filename)];
saveas(gcf,figurepath);
sprintf('%s.emf saved in %s',filename,pathSaveFilePlots)
Michael Wernhart
il 15 Ott 2021
Modificato: Michael Wernhart
il 15 Ott 2021
Michael Wernhart
il 15 Ott 2021
Michael Wernhart
il 15 Ott 2021
Cris LaPierre
il 15 Ott 2021
That suggests to me there might be something with your data. Try creating the figures one at a time and see if you can identify if one of them is not being created properly (perhaps #4?). Inspect the corresponding data for clues as to what may be happening.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Graphics Performance in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!