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]: Regression in dashes due to #22569 #22930

Copy link
Copy link
Closed
@larsoner

Description

@larsoner
Issue body actions

Bug summary

Previously working plotting code has broken. It fails on 96ddc67 / #22569 but passes on the parent daaa1ed.

Code for reproduction

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([0, 1], [0, 1], ls=(0, ()))
plt.show()

Actual outcome

No line shown, error while drawing

  File "/home/larsoner/python/matplotlib/lib/matplotlib/backends/backend_qt.py", line 479, in _draw_idle
    self.draw()
  File "/home/larsoner/python/matplotlib/lib/matplotlib/backends/backend_agg.py", line 424, in draw
    self.figure.draw(self.renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/artist.py", line 73, in draw_wrapper
    result = draw(artist, renderer, *args, **kwargs)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/artist.py", line 50, in draw_wrapper
    return draw(artist, renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/figure.py", line 2860, in draw
    mimage._draw_list_compositing_images(
  File "/home/larsoner/python/matplotlib/lib/matplotlib/image.py", line 131, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/artist.py", line 50, in draw_wrapper
    return draw(artist, renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/axes/_base.py", line 3101, in draw
    mimage._draw_list_compositing_images(
  File "/home/larsoner/python/matplotlib/lib/matplotlib/image.py", line 131, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/artist.py", line 50, in draw_wrapper
    return draw(artist, renderer)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/lines.py", line 772, in draw
    gc.set_dashes(*self._dash_pattern)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/backend_bases.py", line 930, in set_dashes
    raise ValueError(
ValueError: At least one value in the dash list must be positive

Expected outcome

Line shown

Screenshot from 2022-04-28 12-03-38

Additional information

Maybe we use a weird/bad/incorrect convention in our code by creating ls=(0, ()) and we can certainly work around it/fix it, but it used to work at least! At a minimum it might be nice to raise a nicer error if possible...

Operating system

Ubuntu 22.04

Matplotlib Version

96ddc67

Matplotlib Backend

QtAgg (PyQt6)

Python version

3.10.4

Jupyter version

No response

Installation

git checkout

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    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.