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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ def _iter_collection(self, gc, master_transform, all_transforms,
xp, yp = transform.transform_point((0, 0))
xo = -(xp - xo)
yo = -(yp - yo)
if not (np.isfinite(xo) and np.isfinite(yo)):
continue
if Nfacecolors:
rgbFace = facecolors[i % Nfacecolors]
if Nedgecolors:
Expand Down
28 changes: 25 additions & 3 deletions lib/matplotlib/tests/test_scale.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
from __future__ import print_function

from matplotlib.testing.decorators import image_comparison
from matplotlib.testing.decorators import image_comparison, cleanup
import matplotlib.pyplot as plt
import numpy as np
import io


@image_comparison(baseline_images=['log_scales'], remove_text=True)
def test_log_scales():
ax = plt.subplot(122, yscale='log', xscale='symlog')

ax.axvline(24.1)
ax.axhline(24.1)
ax.axhline(24.1)


@cleanup
def test_log_scatter():
"""Issue #1799"""
fig, ax = plt.subplots(1)

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

ax.scatter(x, y)

buf = io.BytesIO()
fig.savefig(buf, format='pdf')

buf = io.BytesIO()
fig.savefig(buf, format='eps')

buf = io.BytesIO()
fig.savefig(buf, format='svg')
0