Skip to content

solves Line2D attribute error with matplotlib 3.7.0 #571

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/tikzplotlib/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ def mpl_linestyle2pgfplots_linestyle(data, line_style, line=None):
default_dashOffset, default_dashSeq = mpl.lines._get_dash_pattern(line_style)

# get dash format of line under test
dashSeq = line._us_dashSeq
dashOffset = line._us_dashOffset
dashOffset = line._dash_pattern[0]
dashSeq = line._dash_pattern[1]
Comment on lines +472 to +473
Copy link

@st-- st-- May 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in https://github.com/nschloe/tikzplotlib/pull/558/files, it would be better to keep this backwards-compatible:

Suggested change
dashOffset = line._dash_pattern[0]
dashSeq = line._dash_pattern[1]
try:
dashOffset, dashSeq = line._dash_pattern[:2]
except AttributeError:
# backwards-compatibility with matplotlib < 3.7.0
dashOffset = line._us_dashOffset
dashSeq = line._us_dashSeq


lst = list()
if dashSeq != default_dashSeq:
Expand Down