8000 prop_cycler for custom dashes -- linestyle such as (<offset>, (<on>, <off>)) throws error · Issue #5850 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
prop_cycler for custom dashes -- linestyle such as (<offset>, (<on>, <off>)) throws error #5850
Closed
@TorbjornT

Description

@TorbjornT

According to the plt.Line2D docs, you should be able to use a tuple like (<offset>, (<on>, <off>)) as a linestyle, and indeed the following works

import matplotlib.pyplot as plt
fig,ax = plt.subplots()
ax.plot([0,1],linestyle='-')
ax.plot([1,2],linestyle=(0,(3,1)))
plt.show()

However, if I try to use the same in a cycler, it doesn't work. For example with the following:

import matplotlib.pyplot as plt
from cycler import cycler
pc = cycler('linestyle', ['-', (0,(3,1))] )
fig,ax = plt.subplots()
ax.set_prop_cycle(pc)
ax.plot([0,1])
ax.plot([1,2])
plt.show()

I get the error AttributeError: 'Line2D' object has no attribute '_dashSeq'.

Is this not intended to work in the first place, or is there something wrong somewhere?

System: miniconda3, recently updated, on Kubuntu 14.04.


(Note: I posted this first as a question on StackOverflow.)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0