I need to generate a 6×9 inch figure with 150 dpi. I also need the final fonts to be size 10pt using the Latex Interpreter. Ultimately this figure will be used in a Latex document.
My challenge is viewing and editing my figure in MATLAB. Obviously a 6×9 figure won't fit on a standard laptop screen, so I've been setting the figure to show on the screen as 3×4.5 inches.
I would like to be able to edit the figure with fonts that are scaled down so that I can see how they fit on the plot while still ending up with a final font size of 10pts.
Ultimately I'm going to be generating quite a few of these plots, so I need to be able to hard code this into my .m file as much as possible.
I've attached a MWE to illustrate my question:
if trueset(0,'defaultTextInterpreter','latex')%Data
x = [0:1:10]; y1 = 5*x; y2 = 6*x; y3= 2*x;%Save Figure Method 1
%save as 3x4.5 inch figure with resolution 300 dpi
%plan to double the size of my figure in the final latex document
%Figure
fig1=figure; set(fig1,'Position',[100,0,300,450]) %The following commands prevent the axes from changing if the figure size is rescaled for printing
ax1 = gca; ax1.XTickMode = 'manual'; ax1.YTickMode = 'manual'; ax1.XLimMode = 'manual'; ax1.YLimMode = 'manual'; %Plot data
plot(x,y1,x,y2,x,y3,'LineWidth',2) set(ax1,'FontSize',5) %Axes
xlim([0,10]) ylim([0,60]) set(ax1, 'XTick', [0:1:10]) set(ax1, 'YTick', [0:10:60]) %Legend
legendcaptions=[{'Line 1','Line 2','Line 3'}]; leg1=legend(legendcaptions,'Location','northeast'); %Title and Labels
title({'Really Long Title Here: Okay on the Computer Screen','but likely not the accurate size in the final plot','since fonts dont scale linearly'}) xlabel('x') ylabel('y') %Figure Properties
fig1.PaperUnits = 'inches'; fig1.PaperPosition = [0 0 900/300 1350/300]; print(fig1,'-depsc','-r300','MME01')%Save Figure Method 2
%save as 6x9 inch figure with resolution 150 dpi
%Figure fig2=figure; set(fig2,'Position',[100,0,300,450]); %The following commands prevent the axes from changing if the figure size is rescaled for printing ax2 = gca; ax2.XTickMode = 'manual'; ax2.YTickMode = 'manual'; ax2.XLimMode = 'manual'; ax2.YLimMode = 'manual'; %Plot data plot(x,y1,x,y2,x,y3,'LineWidth',2) set(ax2,'FontSize',10) %Axes set(ax2, 'XTick', [0:1:10]) set(ax2, 'YTick', [0:10:60]) xlim([0,10]) ylim([0,60]) %Legend legendcaptions=[{'Line 1','Line 2','Line 3'}]; leg2=legend(legendcaptions,'Location','northeast'); %Title and Labels title({'Really Long Title Here: Oversized on the Computer Screen','Fine in Final Plot'}) xlabel('x') ylabel('y') %Figure Properties fig2.PaperUnits = 'inches'; fig2.PaperPosition = [0 0 900/150 1350/150]; print(fig2,'-depsc','-r150','MME02')end
Any help would be greatly appreciated.
Best Answer