0

I can't save bar plot pdf image using export_fig command since I moved to Matlab R2014a.

If I do

var = 1:10
plot(var)
export_fig var.pdf

it works perfectly, while with

bar(var)
export_fig var.pdf

I got

xport LD_LIBRARY_PATH=""; "gs" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="ciao.pdf" -dEPSCrop -sFONTPATH="/usr/share/fonts:/usr/local/share/fonts:/usr/share/fonts/X11:/usr/local/share/fonts/X11:/usr/share/fonts/truetype:/usr/local/share/fonts/truetype" -f "/tmp/tp26894836_5c0b_4ec9_a6de_9ab69d81f8ba.eps": Segmentation fault
/bin/bash: line 1: 28694 Segmentation fault      (core dumped) "gs" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="var.pdf" -dEPSCrop -f "/tmp/tp26894836_5c0b_4ec9_a6de_9ab69d81f8ba.eps"
export LD_LIBRARY_PATH=""; "gs" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="var.pdf" -dEPSCrop -f "/tmp/tp26894836_5c0b_4ec9_a6de_9ab69d81f8ba.eps": Segmentation fault
Ghostscript error: perhaps var.pdf is open by some other application
export_fig error. Please ensure:
that you are using the latest version of export_fig
and that you have Ghostscript installed
and that you do not have multiple versions of export_fig installed by mistake
and that you did not made a mistake in the expected input arguments

If the problem persists, then please report a new issue.

Error using eps2pdf (line 149)
/bin/bash: line 1: 28689 Segmentation fault      (core dumped) "gs" -q   -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="var.pdf" -dEPSCrop
-sFONTPATH="/usr/share/fonts:/usr/local/share/fonts:/usr/share/fonts/X11:/usr/local/share/fonts/X11:/usr/share/fonts/truetype:/usr/local/share/fonts/truetype" -f
"/tmp/tp26894836_5c0b_4ec9_a6de_9ab69d81f8ba.eps"


Error in export_fig (line 588)
            eps2pdf(tmp_nam, pdf_nam, 1, options.append, options.colourspace==2, options.quality, options.gs_options);

Ghostscript is installed (version 9.10) on my machine (Ubuntu 14.04). Any idea?

Thanks

Sfrow
  • 381
  • 1
  • 2
  • 15
  • 1
    what is `export_fig`? is it taken from here: http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig ? – m.s. Apr 17 '15 at 14:13
  • 3
    that may be not a satisfying answer, but if you have problems with an external function, contact the author. However, `export_fig` is an quite obsolete function, write your own one and you know whats going on and going wrong. [Get some inspiration here](http://stackoverflow.com/questions/5150802/how-to-save-a-plot-into-a-pdf-file-without-a-large-margin-around/19420712) – Robert Seifert Apr 17 '15 at 14:17
  • Which version of Ghostscript do you have installed ? I see from the command line that the input is named "/tmp/tp26894836_5c0b_4ec9_a6de_9ab69d81f8ba.eps" I would suggest that you capture that file and try running the Ghostscript command at the shell. If that fails in the same way (and you are using the current version of Ghostscript) then you can open a bug report. – KenS Apr 17 '15 at 14:36
  • `export_fig` is from [here](https://github.com/altmany/export_fig) or from the link @m.s. posted. It is not obsolete, I guess. Last update was yesterday! And it is very powerful to save matlab figures. :) @KenS I will give a try to your idea! ;) – Sfrow Apr 17 '15 at 14:42
  • Ghostscript version is 9.10! – Sfrow Apr 17 '15 at 14:44
  • @thewaywewalk thanks for the link, it looks interesting! ;) – Sfrow Apr 17 '15 at 14:48
  • 1
    @Sfrow it's obsolete in terms of it covers all possible cases for all possible applications. In 99% of the cases you get the same result with just 3 lines of your own code. Much faster and you know what is happening. I don't want to say it is bad function and its great work of the authors, but it is just tooooo much. – Robert Seifert Apr 17 '15 at 14:53
  • @thewaywewalk I see now what you mean! But I have used too many times `export_fig`, I would like to find a solution. Too lazy to change'em all! :) If I don't find a solution for `export_fig`, I will go for three-fast-line-of-code! ;) – Sfrow Apr 17 '15 at 15:05

0 Answers0