Corrupt/invalid PDF and EPS files when saving a logscaled plot made with negative values #1799

merged 1 commit into from Mar 7, 2013


None yet

3 participants


This is with matplotlib 1.1.0, via the Pylab interface (I'm using a version supplied with PythonXY):

import pylab as p
import numpy as np

x = np.arange(10)
y = np.arange(10)-1


Saving the plot as an EPS or PDF produces an invalid file; when opening the PDF, Adobe Reader says "Path lacks initial MOVETO". PNG output looks fine.

Granted, negative values can't be plotted on a log scale, but creating a bad output file seems like a bug. As a workaround, I now filter my data for negative values before plotting.


Fixed, I think, by #684. Although, admittedly, that bug threw an exception
during runtime.


Just tried it with matplotlib 1.2.0 (new install via pip on Linux). When saving a PDF, I get a popup saying "Can only output finite numbers in PDF". When saving EPS, the save completes but the file can't be opened in any EPS viewer I tried.

mdboom commented Mar 7, 2013

Good catch. This seems to be specific to path collections, which is rare on a log plot, so we haven't caught it. Expect a fix shortly.

mdboom commented Mar 7, 2013

@andrewcollette: Would you mind testing the attached patch to confirm that it addresses your issue?

@mdboom mdboom merged commit ff749cb into matplotlib:v1.2.x Mar 7, 2013

1 check passed

default The Travis build passed
@HubertHolin HubertHolin added a commit to HubertHolin/matplotlib that referenced this pull request Apr 7, 2013
@mdboom @HubertHolin mdboom + HubertHolin Fix #1799: path collections with NaNs in the path cause exceptions in…
… vector backends.
@mdboom mdboom deleted the mdboom:issue1799 branch Aug 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment