Skip to content

backend_svg fails with dashed line style #17290

Closed
@nschloe

Description

@nschloe

When using a dashed line style, the SVG backend fails. MWE:

import matplotlib.pyplot as plt

plt.style.use({"axes.grid": True, "grid.linestyle": (10, 10)})

x = [1, 2, 3]
y = [1, 2, 3]
plt.plot(x, y)
# plt.show()  # works fine
plt.savefig("out.svg")
[...]
  File "~/.local/lib/python3.8/site-packages/matplotlib/backends/backend_svg.py", line 435, in _get_style_dict
    attrib['stroke-dashoffset'] = short_float_fmt(float(offset))
TypeError: float() argument must be a string or a number, not 'NoneType'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions