Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prop_cycler for custom dashes -- linestyle such as (<offset>, (<on>, <off>)) throws error #5850

Closed
TorbjornT opened this issue Jan 14, 2016 · 1 comment · Fixed by #5852
Closed
Assignees
Milestone

Comments

@TorbjornT
Copy link

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.)

@tacaswell
Copy link
Member

This is a fun bug which is due to a slight difference in order of operations in how we handle user supplied vs default kwargs. I willl have a minimal PR up shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants