Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug]: Line2D.set_linestyle treats dash pattern with None onoffseq as dashed #23437

Copy link
Copy link
Open
@mwaskom

Description

@mwaskom
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.