Skip to content

[Bug]: dotted line with "lw=0" breaks Adobe Acrobat Reader #24371

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
ultimatile opened this issue Nov 4, 2022 · 4 comments
Closed

[Bug]: dotted line with "lw=0" breaks Adobe Acrobat Reader #24371

ultimatile opened this issue Nov 4, 2022 · 4 comments

Comments

@ultimatile
Copy link

ultimatile commented Nov 4, 2022

Bug summary

When a figure that uses ls=":" and lw=0 is saved as a pdf, it does not render correctly only in Adobe Acrobat Reader.

Code for reproduction

import matplotlib.pyplot as plt
fig, ax = plt.subplots() 
ax.plot([0], [0], ":", lw=0)
plt.savefig("test.pdf")

Actual outcome

Adobe Acrobat Reader

スクリーンショット 2022-11-05 6 38 08

Expected outcome

other pdf viewers

I tried Skim, Chrome, and Safari.
スクリーンショット 2022-11-05 7 05 21

Additional information

Other line style keys, "-", "--" and "-." work fine.

It may be a related discussion.
#1188 (comment)

Operating system

macOS 10.15.7

Matplotlib Version

3.1.0

Matplotlib Backend

module://ipykernel.pylab.backend_inline, MacOSX

Python version

3.7.4

Jupyter version

6.0.1

Installation

conda

@tacaswell
Copy link
Member

@ultimatile Does this reproduce with a newer version of Matplotlib? 3.1.0 is pretty old now and we have made a number of changes to the pdf backend.

This does remind me of some performance issues we had with the dash pattern scaling with very thin lines because there ended up being way too many segments, however the failure mode of taking out the other lines is very odd.

@tacaswell
Copy link
Member

In 3.6.2 this now raises

File /usr/lib/python3.10/site-packages/matplotlib/backend_bases.py:926, in GraphicsContextBase.set_dashes(self, dash_offset, dash_list)
    923         raise ValueError(
    924             "All values in the dash list must be non-negative")
    925     if dl.size and not np.any(dl > 0.0):
--> 926         raise ValueError(
    927             'At least one value in the dash list must be positive')
    928 self._dashes = dash_offset, dash_list

ValueError: At least one value in the dash list must be positive

I think at some point we "fixed" this by making it impossible to generate broken pdfs. @ultimatile are you OK if we close this?

@tacaswell
Copy link
Member

I'm going to go ahead a close this as it is no longer reproducible.

@ultimatile If you can reproduce this with a newer version of Matplotlib please ping to have the re-opened or open a new issue!

@ultimatile
Copy link
Author

Thank you for your replies, and sorry for my late response.
I tried to update the version of matplotlib, but I am having some trouble, and have still been with version 3.5.3.
Therefore, I have not confirmed the issue with version 3.6.2.
I have no objection to closing it since the problem should have been "solved."
As you suggested, I will address the issue if it arises again in the latest version.

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

3 participants