How to print figure to an .eps file properly?

75 ビュー (過去 30 日間)
tensorisation
tensorisation 2019 年 8 月 17 日
コメント済み: the cyclist 2019 年 8 月 28 日
I'm printing the same figures as .png and .eps files. The .png looks fine, but the .eps appear to have some issues:
  • Somehow the image is cut to minimal space, but it also appear to cut the last number in my X axis.
  • My Y axis is set to a log scale, and so the 10^x (x=0,1,2,...) numbers don't look good at all (they look fine in the .png file).
  • In the legend of one of my figures there is an equation using sprintf(...). The text there doesn't scale properly with the box of the legend - it goes beyond the box untill it is cut in the bounds of the image.
I'm using the commands:
...
print(figure_current,'-dpng','-r200',file_figure_png_full_location);
...
print(figure_current,'-depsc','-painters',file_figure_eps_full_location);

採用された回答

the cyclist
the cyclist 2019 年 8 月 19 日
Try using '-opengl' rather than '-painters' for the renderer.
  5 件のコメント
Rik
Rik 2019 年 8 月 28 日
If I recall correctly, print selects the renderer based on the image format (pixel or vector). That should be mentioned in the doc.
the cyclist
the cyclist 2019 年 8 月 28 日
I don't recall for sure, and I'm currently on a machine that doesn't have MATLAB installed (horrors!) so I can't check. But I think the default renderer might be something like "Auto", meaning that the MATLAB will choose which one to use based on properties of the figure. I poked around the documentation a bit, but could not find a definitive answer.

サインインしてコメントする。

その他の回答 (1 件)

the cyclist
the cyclist 2019 年 8 月 17 日
Try using export_fig.
  1 件のコメント
tensorisation
tensorisation 2019 年 8 月 18 日
編集済み: tensorisation 2019 年 8 月 18 日
Before resorting to trying to use this external elaborate shared library tool, isn't there a way to just properly save a figure as an .eps file in Matlab?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by