altmany / altmany/export_fig

export_fig failing to pdf 2x2 subplot

Open
#282 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
MATLAB
Stars
1.4k
Forks
366
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/altmany/export_fig/files/3498330/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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.