Bug summary
The logic for setting linestyle using a dash tuple, i.e. (offset, onoffseq), does not properly handle the case where onoffseq is None.
Code for reproduction
print(mpl.lines.Line2D([], [], linestyle=(0, None)).get_linestyle())
Actual outcome
'--'
Expected outcome
Ideally, dash values would roundtrip, so the return would be (0, None). Even when the dash sequence is not None, a lot of information is lost when this property is queried.
But more narrowly, (0, None) draws a solid line, so the return value should be '-'.
Additional information
The main consequence here is that the line's capstyle appears to conditionally read from solid_capstyle or dash_capstyle depending on the get_linestyle return value.
Matplotlib Version
3.5.2
Bug summary
The logic for setting linestyle using a dash tuple, i.e.
(offset, onoffseq), does not properly handle the case whereonoffseqisNone.Code for reproduction
Actual outcome
'--'Expected outcome
Ideally, dash values would roundtrip, so the return would be
(0, None). Even when the dash sequence is notNone, a lot of information is lost when this property is queried.But more narrowly,
(0, None)draws a solid line, so the return value should be'-'.Additional information
The main consequence here is that the line's capstyle appears to conditionally read from
solid_capstyleordash_capstyledepending on theget_linestylereturn value.Matplotlib Version
3.5.2