Skip to content

Commit b4e6b21

Browse files
st--thomasgillis
andauthored
solves Line2D attribute error with matplotlib 3.7.0 (#3) [copy of nschloe#571]
* solves attribute error with matplotlib `3.7.0` the error on most recent matplotlib version is the following: ```bash AttributeError: 'Line2D' object has no attribute '_us_dashSeq' ``` * Update src/tikzplotlib/_path.py --------- Co-authored-by: Thomas Gillis <[email protected]>
1 parent 02e872d commit b4e6b21

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/tikzplotlib/_path.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,12 @@ def mpl_linestyle2pgfplots_linestyle(data, line_style, line=None):
469469
default_dashOffset, default_dashSeq = mpl.lines._get_dash_pattern(line_style)
470470

471471
# get dash format of line under test
472-
dashSeq = line._us_dashSeq
473-
dashOffset = line._us_dashOffset
472+
try:
473+
dashOffset, dashSeq = line._dash_pattern[:2]
474+
except AttributeError:
475+
# backwards-compatibility with matplotlib < 3.7.0
476+
dashOffset = line._us_dashOffset
477+
dashSeq = line._us_dashSeq```
474478

475479
lst = list()
476480
if dashSeq != default_dashSeq:

0 commit comments

Comments
 (0)