Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Jens Hedegaard Nielsen <jenshnielsen@gmail.com> <jens.nielsen@ucl.ac.uk>
John Hunter <jdh2358@gmail.com>
Jorrit Wronski <jowr@mek.dtu.dk>
Jouni K. Seppänen <jks@iki.fi>
Joseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com> Mad Physicist <madphysicist@users.noreply.github.com>
Julien Schueller <julien.schueller@gmail.com> <schueller@porsche-l64.phimeca.lan>
Julien Schueller <julien.schueller@gmail.com> <schueller@bx-l64.phimeca.lan>
Kevin Davies <kdavies4@gmail.com> <daviesk24@yahoo.com>
Expand Down
3 changes: 3 additions & 0 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,9 @@ def set_drawstyle(self, drawstyle):
ACCEPTS: ['default' | 'steps' | 'steps-pre' | 'steps-mid' |
'steps-post']
"""
if drawstyle not in self.drawStyles:
raise ValueError('Unrecognized drawstyle ' +
' '.join(self.drawStyleKeys))
if self._drawstyle != drawstyle:
self.stale = True
self._drawstyle = drawstyle
Expand Down
23 changes: 23 additions & 0 deletions lib/matplotlib/tests/test_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,29 @@ def test_valid_linestyles():
line.set_linestyle('aardvark')


@cleanup
def test_drawstyle_variants():
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
for ds in ("default", "steps-mid", "steps-pre", "steps-post",
"steps"):
ax.plot(range(10), drawstyle=ds)

fig.canvas.draw()
assert True


@cleanup
def test_valid_drawstyles():
if sys.version_info[:2] < (2, 7):
raise nose.SkipTest("assert_raises as context manager "
"not supported with Python < 2.7")

line = mlines.Line2D([], [])
with assert_raises(ValueError):
line.set_drawstyle('foobar')


@image_comparison(baseline_images=['line_collection_dashes'], remove_text=True)
def test_set_line_coll_dash_image():
fig = plt.figure()
Expand Down