Reputation: 49
I have 2 different figures. One of them is an empty template with logos, a kind of a background. The other one is the existing subplots. The question is, how can I make matlab generate the subplots on this empty template figure with logos ?
tempfigure1 = figure('PaperType','A4','PaperSize',[29.7 21],'PaperOrientation', 'landscape',...
'Color',[1 1 1],'Units', 'centimeters','Position',[2 2 29.7 21]);
% The code continues like this with tempfigure1
A part of the other figure is created with this code:
subplot(tempPosition{tempCNT,1},tempPosition{tempCNT,2},tempPosition{tempCNT,3});
%all temp*s are already defined before this line
With those codes, matlab gives me 2 different figures that I don't need. After creating them both in a figure I would like to export it as pdf with this following code which just exports one of the figures :
print(gcf, '-dpdf', 'output.pdf');
I appreciate your help !
Regards,
Tolga
Upvotes: 0
Views: 74
Reputation: 1189
You are probably looking for the hold command. There you can hold a figure to do all the plotting in. For instance:
figure(1)
hold on % Tell MatLab to plot everything in this figure
plot(1:10,1:10,'-r') % Plot a red line
plot(1:10,2:11,'-g') % Plot a green line
hold off
Then export your figure as you proposed:
print(gcf, '-dpdf', 'output.pdf');
Good luck!
Upvotes: 1