- Use the following
Why does subplot size change with increasing number of plots
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am preparing a script which will prepare and print a flexible number of plots. When i have less than 5 plots everything looks fine (attached figure 1), but when i have more that 5 plots the figure size decrease and the legenbox starts to look strange (attached figure 2). How can I fix my code so my plots and legens looks like figure regardless of the number og plots.
I will need to create a long figure depending on the number of plots, and i don't need to print out on paper. Therefore I don't need to use A4 paper. My code looks like this:
fig = figure;
set(fig,'visible','off');
m = 25 % This is the number of plots in total
for k = 1:25
plotdata = Matrix{k,1};
Legend=LegendMatrix{k,1};
subplot(m,1,k);
hold on
plot(time,plotdata,'MarkerFaceColor','auto','MarkerSize',2,'Marker','square','LineWidth',1);
plot(Xvalue,Yvalue','Marker','o','MarkerSize',2,'MarkerEdgeColor','k','Markerfacecolor','k','LineStyle','none');
set(gca,'FontSize',16);
xlim([0 mtime(end)]);
set(gca,'XTick',Xlocation);
set(gca,'XTickLabel',Xlabel);
xlabel('Time [days]');
ylabel('Fluorescence [RFU]');
title(Titles{k},'Interpreter','none');
leg = legend(Legend,'Location','southoutside','FontSize',13,'NumColumns',2);
leg.ItemTokenSize = [1,1]; % Legend line length and width
box on
hold off
end
end
set(fig,'Papersize', [19 18*m]);
set(fig,'PaperUnits','normalized');
print(fig,'-fillpage','-dpdf',fullfile(DataPath,'Full.pdf'));
end
Figure 1
Figure 2
0 Commenti
Risposte (1)
KALYAN ACHARJYA
il 21 Gen 2020
Modificato: KALYAN ACHARJYA
il 21 Gen 2020
I dont think figures are changing, just scaling the figure window as per the screen size (please check the scaling of plot axes, all are same)
Way out:
subplot(5,5,k); % Still it gives the 5 by 5 window, total 25
2. Or print the individual window with loop and later do collage / montage function
for
plot
print or save the plot
end
0 Commenti
Vedere anche
Categorie
Scopri di più su Line Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!