With the two plots in the same unit system, this behavior is expected -- although maybe not well/accurately documented. (from help post
)
In `eps` mode the whole plot, including the fonts, is reduced to half of
the default size.
Since you specified a size explicitly, that part sticks, but the fonts are still reduced in size by a factor of 2 on the eps
plot even if you specify a font explicitly (I don't know why this is, but it's always been that way -- I've always considered it a bug in the documentation at least ... ).
As far as switching the units to centimeters -- I'm not at my computer with the cairo
terminals enabled, so I can't check right now ... but that seems odd (to me). Is it perhaps because the conversion to centimeters from inches is about a factor of 2 which makes them look so similar? (e.g. your fonts are half the size while your plot is 1/2.54 the size)
To achieve terminal independence, I suppose you could write it up in a function (CURRENTLY UNTESTED):
fontsize(x)=((GPVAL_TERM eq 'postscript') && \
(strstrt(GPVAL_TERMOPTIONS,"eps")!=0)) ? x*2 : x
set term post eps enh size 10in,8in
set termoption font "Arial,".fontsize(7)
set output "Hello.eps"
plot sin(x)
set term pdfcairo enh size 10in,8in
set termoption font "Arial,".fontsize(7)
set output "Hello.pdf"
plot sin(x)
Make sure you only pass integers to fontsize -- integers get promoted to strings when doing string concatenation.
EDIT
After digging a little further, it appears that the cairo library is taking some liberties and embedding a (similar) font that you didn't ask for.
running pdffonts myfile.pdf
-- Note that you get the fontname just by strings myfile.pdf | grep FontName
:
name type emb sub uni object ID
-------------------- ------------ --- --- --- ------ --
LiberationSansBold CID TrueType yes no yes 5 0
whereas the postscript just contains the font name (not embedded) which gets translated by the ps viewer as the closest thing it can find to the requested font (It [probably] substitutes a font you didn't ask for also). So, to achieve true terminal independence (between these two terminals), you'd need to find the fontfile that was embedded in the pdf and then set postscript eps enh color fontfile add "<fontfile>"
to embed the same fontfile in both the pdf and the postscript.
Best Answer
The label position and the margins are calculated based on the overall terminal font size, which can be set with
set terminal
orset termoption font ',20'
.So if you increase the font size locally (only for the title and axes labels), the margins and the label positions are wrong.
You can set explicit margins like
set lmargin 5
, which reserves a left margin corresponding to 5 character widths, or even absolute margins with e.g.set lmargin at screen 0.1
. Fortitle
andxlabel
there is anoffset
option, which allows to adjust the label position relative to the default position.