Incorrect PDF output with rasterized=True · Issue #3371 · matplotlib/matplotlib · GitHub
Skip to content

Incorrect PDF output with rasterized=True #3371

Description

@astrofrog

The following example demonstrates an issue with the PDF output when setting rasterized=True:

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection

fig = plt.figure()
ax = fig.add_subplot(1,1,1)
z = np.random.random((100000, 3, 2))
lc = LineCollection(z, rasterized=True, alpha=0.01, color='k')
ax.add_collection(lc)
fig.savefig('test.png')
fig.savefig('test.pdf')

The PNG output is:

test

The PDF output (converted to PNG, looks the same), is:

test_pdf

For some reason, the PDF output appears gray not black in the center.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions