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

axhline and axvline linestyle as on-off seq doesn't work if set directly in function call #6449

Closed
grg2rsr opened this issue May 19, 2016 · 1 comment
Milestone

Comments

@grg2rsr
Copy link
Contributor

grg2rsr commented May 19, 2016

the following does not work:

import matplotlib.pyplot as plt
ls = (0,(2,2))
plt.plot()
line = plt.axvline(1,linestyle=ls)

however:

line.set_linestyle(ls)

produces the expected result. both axhline and axvline are affected, axhspan and axvspan not.

matplotlib '1.5.1' installed through Anaconda on Ubuntu 15.10.

Traceback:

Traceback (most recent call last):
  File "/home/georg/python/linestyle_bug.py", line 13, in <module>
    line = plt.axhline(0,1,linestyle=ls)
  File "/home/georg/anaconda2/lib/python2.7/site-packages/matplotlib/pyplot.py", line 2574, in axhline
    ret = ax.axhline(y=y, xmin=xmin, xmax=xmax, **kwargs)
  File "/home/georg/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 749, in axhline
    l = mlines.Line2D([xmin, xmax], [y, y], transform=trans, **kwargs)
  File "/home/georg/anaconda2/lib/python2.7/site-packages/matplotlib/lines.py", line 332, in __init__
    self.set_linestyle(linestyle)
  File "/home/georg/anaconda2/lib/python2.7/site-packages/matplotlib/lines.py", line 1029, in set_linestyle
    self.set_dashes(ls[1])
  File "/home/georg/anaconda2/lib/python2.7/site-packages/matplotlib/lines.py", line 1165, in set_dashes
    if self._dashSeq != seq:
AttributeError: 'Line2D' object has no attribute '_dashSeq'
@tacaswell tacaswell modified the milestones: 2.0.1 (next bug fix release), 1.5.2 (Critical bug fix release) May 19, 2016
@tacaswell
Copy link
Member

Thank you for reporting this. I can not reproduce this on v1.5.x and think this is a variation on #5850 which is fixed by #5852

Please ping to have this re-opened if you can reproduce this on any of the active dev branches.

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

No branches or pull requests

2 participants