Skip to content

BUG: PDF export seems wrong with dash sequences that include a None offset #8405

Closed
@afvincent

Description

@afvincent

Bug summary

Custom dash sequences of the form (None, on_off_seq) seem to be rendered as solid lines in PDF exports.

Code for reproduction

import matplotlib.pyplot as plt

fig, ax = plt.subplots(num="mwe")

linestyles = ('dashed', '--', (None, (3.7, 1.6)), (0, (3.7, 1.6)))
for y, ls in enumerate(linestyles):
    ax.plot([y]*2, ls=ls, label='{0}'.format(ls))

ax.set_ylim(-0.5, len(linestyles) - 0.5)  # useful on mpl < 2
ax.legend()

for ext in ('.png', '.pdf'):
    fig.savefig(fig.get_label() + ext)

Actual outcome
screenshot_of_mwe_v2 0 0
Please note that the picture above is a manual screenshot of the PDF produced with Matplotlib. For an unknown reason, GitHub does not allow me to upload the original PDF file…

Expected outcome
Something like the PNG export of the same plot:
mwe_v2 0 0

Both PNG and PDF look fine when exported with Matplotlib 1.5.1 (from conda). PDF export seems to be “broken” in this case both with Matplotlib 2.0.0 (from conda) and and master (from GitHub).

OS: CentOS 7
Python: 2.7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions