Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export_fig failing to pdf 2x2 subplot #282

Open
diegocaba opened this issue Aug 13, 2019 · 1 comment
Open

export_fig failing to pdf 2x2 subplot #282

diegocaba opened this issue Aug 13, 2019 · 1 comment

Comments

@diegocaba
Copy link

diegocaba commented Aug 13, 2019

Hi Altmany - love the script, usually works like a charm. First time it fails me though..
I have a 2x2 subplot, all four of them are somewhat busy (stacked bar plots, lines on top, text annotations, legends, etc). If each of them is a standalone figure, export_fig handles it fine into a pdf. When it's subplot however, I get this ghostscript and/or eps2pdf error [note that if I try exporting to eps it gives me the same error]:

Ghostscript error: perhaps C:\Users\caballe\AppData\Local\Temp\tpc94c40f4_e46e_4e7b_93f6_22c7fe1fe27c.pdf is open by another application
or maybe you have another gs executable in your system's path
Ghostscript options: -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="C:\Users\caballe\AppData\Local\Temp\tpc94c40f4_e46e_4e7b_93f6_22c7fe1fe27c.pdf" -dEPSCrop -sFONTPATH="C:\WINDOWS\Fonts" -f "C:\Users\caballe\AppData\Local\Temp\tpcbcea88b_b128_4d8e_b3fc_2aa03f1df970.eps"

Error using eps2pdf (line 173)
Error: /rangecheck in --stroke--
Operand stack:
true
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1
%stopped_push 1 3 %oparray_pop 1 3 %oparray_pop --nostringval-- 1 3 %oparray_pop 1 3 %oparray_pop .runexec2 --nostringval--
--nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
--dict:1122/1686(ro)(G)-- --dict:0/20(G)-- --dict:115/200(L)--

Current allocation mode is local
Current file position is 32402
AFPL Ghostscript 8.14: Unrecoverable error, exit code 1

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

In those directories where ghostscript fails there are half rendered pdf files but not with all the information in the figure. Any thoughts/ideas? Thanks!!

For reference, this is the half-rendered PDF:
tpc94c40f4_e46e_4e7b_93f6_22c7fe1fe27c.pdf

EDIT: I've boiled down the error to using the bar command to plot these histograms. I can get the render to generate a PDF if I use histogram for example, but of course stacking is so much easier with bar. Any insight appreciated. For the record, I am using Matlab 2018a on windows 7.

@diegocaba diegocaba changed the title export_fig failing to pdf complex plot export_fig failing to pdf 2x2 subplot Aug 13, 2019
@altmany
Copy link
Owner

altmany commented Jan 7, 2020

@diegocaba - can you recreate the Ghostscript error when you use export_fig on a simple plot that uses bar()? if so - please send me the Matlab code that reproduces this problem (the simpler the script, the better)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants