nav-left cat-right
cat-right
Home > Blog > Programming > matlab > Matlab figures – solving export problems

Matlab figures – solving export problems

savefig

This is a matlab script which intends to provide cropped and clean pictures. This is done by exporting to eps and following conversion to the other formats by using Ghostscript.

png export

This script suffers from the eps font bug as well. There is thus not much difference to pure matlab:painters eps export.

export_fig

The tool collection export_fig with examples found here provides solutions for most matlab problems such as visual accuracy, resolution, the shrinking dots & dashes bug, and many others. It uses Ghostscript and xpdf internally.

painters renderer

the linestyle quality is perfect. However since this script relies on eps export it includes the font problem

opengl renderer

Here the font is correct, as already with matlab standard opengl export. But it demonstrates cleary the shrinking dots & dashes bug!

plot2svg

The tool plot2svg tries to solve all the problem described so far by exporting to svg. From here png, eps and pdf conversion is possible without any loss or change of quality

This picture was created by exporting to png with 600dpi resolution. It shows that fonts and linestyles are perfect. However the whole plot is cropped at the upper boundary, which clearyl is a bug of this approach or this script.

latexfigure

This is my own approach to this problem. It uses matlabfrag to get around the eps font problem. The linestyles are corrected using the ‘fix_lines.m’ script from export_fig. However this requires a complete LaTeX collection and converts the resulting pdf afterwards in the target format. This script was inspired by mlf2pdf and I had to patch matlabfrag to support also non math fonts.

Here linestyles and fonts are correct. Only the title is in bold which was introduced by matlabfrag.

Seiten: 1 2 3 4

4 Antworten : “Matlab figures – solving export problems”

  1. Oliver Woodford sagt:

    The output of latexfigure looks great! I’ve wanted to find a good solution to separating text and graphics for some time, and this looks like it. I would love to see it on the Matlab Central File Exchange, or else be able to download the latest version from somewhere.

  2. pospiech sagt:

    Currently I have not the time for this code (I am partly still working on it). But I promise to publish it within the next month…

    In the meantime you can still use the matlabfrag package which is what I use internally.

  3. Jannes sagt:

    Thanks for the great code!

    I do have a problem when trying to plot over very small or large ranges (i.e. 1E-07, 1E07..). It seems that Ghostscript can’t handle that form of notation? I’m running Matlab on OSX (Snow Leopard).

    Thanks a lot

Einen Kommentar schreiben

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

*


*

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Spam Protection by WP-SpamFree