E486 axhline and axvline linestyle as on-off seq doesn't work if set directly in function call · Issue #6449 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
axhline and axvline linestyle as on-off seq doesn't work if set directly in function call #6449
Closed
@grg2rsr

Description

@grg2rsr

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'

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

      0