8000 Corrupt/invalid PDF and EPS files when saving a logscaled plot made with negative values by mdboom · Pull Request #1799 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

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

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

Merged
merged 1 commit into from
Mar 7, 2013

Conversation

mdboom
Copy link
Member
@mdboom mdboom commented Mar 7, 2013

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

p.scatter(x,y)
p.xscale('log')
p.yscale('log')

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.

@WeatherGod
Copy link
Member

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

@andrewcollette
Copy link
Author

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
Copy link
Member
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
Copy link
Member
mdboom commented Mar 7, 2013

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

mdboom added a commit that referenced this pull request Mar 7, 2013
Corrupt/invalid PDF and EPS files when saving a logscaled plot made with negative values
@mdboom mdboom merged commit ff749cb into matplotlib:v1.2.x Mar 7, 2013
HubertHolin pushed a commit to HubertHolin/matplotlib that referenced this pull request Apr 7, 2013
@mdboom mdboom deleted the issue1799 branch August 7, 2014 13:49
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

Successfully merging this pull request may close these issues.

3 participants
0