Font size and figure size when printing figure to .eps

22 views (last 30 days)
When I print my figure to .eps the fonts change in size (increase from 10pt to 12.5pt) and the figure size is smaller than set (I set 8x6 cm, but it comes out 6.3x5.2 cm). Here is my figure formatting code with dummy data:
clear all, close all, clc
%data plot
xaxis = linspace(0,10,50);
data1 =sin(xaxis);
plot(xaxis,data1)
%axis labels
hXLabel = xlabel('Frequency (Hz)');
hYLabel = ylabel('RMS Output Voltage (mV)');
set([hXLabel, hYLabel],...
'FontName','Times New Roman');
set([hXLabel, hYLabel],...
'FontSize',10);
set([gca], ...
'FontName','Times New Roman' );
set([gca], ...
'FontSize', 10);
%figure size
set(gca, ...
'Units', 'centimeters');
set(gca, ...
'OuterPosition', [0 0 8 6]);
set(gcf, ...
'Units', 'centimeter');
set(gcf, ...
'Position', [8 10 8 6]);
set(gcf, ...
'PaperUnits','centimeters');
set(gcf, ...
'PaperSize',[8 6]);
set(gcf, ...
'PaperPosition',[0 0 8 6]);
%output .esp file
set(gcf, 'PaperPositionMode', 'auto');
print -depsc2 -painters Plot1.eps
First off, you will note I set the figure size using OuterPosition, Position, PaperSize, and PaperPosition. In the end, just using Position while setting PaperPositionMode to 'auto' usually works fine, but if someone would like to comment on which is best to use I am all ears.
When I open the .eps figure in inkscape, the fonts are 12.5pt and the figure size is smaller than asked for. I can scale the figure size approximately, but I cannot understand why the font size changes. Here is a screen shot of the final figure in inkscape. Note the image size ruler, in centimeters, and font size dialog box.

Accepted Answer

John
John on 19 Jun 2014
Edited: John on 19 Jun 2014
The answer to the question has to do with the units used for font size in inkscape (this is not a problem with matlab). Inkscape uses 90dpi rendering while matlab and most other things use 72dpi. That means the inkscape will show the font size being 90/72 = 1.25 times bigger than the actual size. When printed, the actual size will still be 10pt, not 12.5 shown by inkscape. See my inkscape forum question for more details.
Also, I've decided using just the 'Position' property is the best way to go. I still set 'PaperPositionMode' to auto, though.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!