Effacer les filtres
Effacer les filtres

Why does subplot size change with increasing number of plots

1 vue (au cours des 30 derniers jours)
Johnny Birch
Johnny Birch le 20 Jan 2020
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 1.png
Figure 2
figure 2.png

Réponses (1)

KALYAN ACHARJYA
KALYAN ACHARJYA le 21 Jan 2020
Modifié(e) : KALYAN ACHARJYA le 21 Jan 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:
  1. Use the following
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

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by