Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

Closed
afvincent opened this issue Mar 30, 2017 · 5 comments
Closed
Milestone

Comments

@afvincent
Copy link
Contributor

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

@afvincent afvincent added this to the 2.0.1 (next bug fix release) milestone Mar 30, 2017
@kahnchana
Copy link
Contributor

What do you use for viewing pdfs? I got them same problem. However when the PDF is opened in chrome it showed up fine. Also for adobe reader 9 and edge it didn't even show the top two lines. Will go through this.

@afvincent
Copy link
Contributor Author

I have the issue with Evince, MuPDF, xpdf and qpdfview.

@tacaswell
Copy link
Member

my guess is an overly agressive cut-out looking for None in the pdf backend.

@QuLogic QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0.2 (next bug fix release) May 3, 2017
@jkseppan
Copy link
Member

It seems to me that the linestyle documentation specifies "(offset, on-off-dash-seq)" and only explains what the on-off-dash-seq can be. It doesn't really say what the type of the offset should be, but I don't see how it could be anything but a number, so the bug is that this generates invalid PDF output instead of erroring out.

@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.2 (next feature release) Oct 9, 2017
@QuLogic
Copy link
Member

QuLogic commented Mar 11, 2020

Passing None is deprecated as of #15828, so I don't think we have any plans to fix this.

@QuLogic QuLogic closed this as completed Mar 11, 2020
@QuLogic QuLogic modified the milestones: needs sorting, v3.3.0 Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants