Why do all text in figures move when saving as eps?

2 visualizzazioni (ultimi 30 giorni)
et11mpn
et11mpn il 12 Apr 2018
Modificato: et11mpn il 5 Giu 2018
xlabels move to the left, ylabels move down, titles move to the left. If I use, for example:
text(0.5,0.95,'12 V','units','normalized','horizontalalignment','center')
then '12 V' will appear centered in the plot, near the top, as it should. After saving, however, it will have shifted slightly to the left.
Perhaps the "center" is recalculated as the center of the entire figure rather than just the center of the plot. (EDIT: This cannot be entirely true because the longer the text is, the more it moves.)
I have tried saving with print(gcf,'-depsc','figname') and hgexport(gcf,'figname') as well as just using the Export option in the Plot Tools window, but in all cases the same thing happens.
I read somewhere that there is a bug with the legends if you use set PaperPosition, because it changes the PaperPositionMode from auto to manual. I have tried setting it to auto and I have tried restarting Matlab and saving figures without ever setting the PaperPosition, since apparently 'auto' should be the default mode. Still, the same thing happens.
The attached figure shows an example generated with the command sequence:
>> plot([1 2], [1 2])
>> grid on
>> text(0.5,0.95,'test text test text','units','normalized','HorizontalAlignment','center')
>> title('test title test title test title')
>> xlabel('xlabel (units)')
>> ylabel('ylabel (units)')
>> legend('legend','location','northwest')
and exported from the Plot Tools window.
This is all when I save the figures as eps files. The problem does not arise if I use png instead.
The Matlab version I use is R2018a for Linux (64-bit Debian).
EDIT: I don't get this problem using SVG instead of EPS. However, I've seen people saying "SVG was designed for the web while EPS is intended for print" and I'm working on something that's not for the web but will be printed. Also, I'm using LaTeX which does not natively support SVG.
  6 Commenti
Ameer Hamza
Ameer Hamza il 25 Apr 2018
If you have some doubt about the rendering of eps on Linux, you can try an online viewer. It might be some bug with the MATLAB on Debian.
et11mpn
et11mpn il 27 Apr 2018
Thanks again! The online viewer showed the same problem, so ye it's probably because I'm using Debian.

Accedi per commentare.

Risposte (1)

phnerd
phnerd il 12 Apr 2018
this figure can be saved as emf. what's the different between this two kinds of format?
  1 Commento
et11mpn
et11mpn il 12 Apr 2018
They're both vector graphics so it would probably look just as good, and maybe there's no text displacement, but I can't use it since I'm on Linux. Wmf and emf seem to be Windows exclusives.

Accedi per commentare.

Categorie

Scopri di più su Printing and Saving in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by