File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1002,6 +1002,8 @@ def set_drawstyle(self, drawstyle):
1002
1002
raise ValueError ('Unrecognized drawstyle {!r}' .format (drawstyle ))
1003
1003
if self ._drawstyle != drawstyle :
1004
1004
self .stale = True
1005
+ # invalidate to trigger a recache of the path
1006
+ self ._invalidx = True
1005
1007
self ._drawstyle = drawstyle
1006
1008
1007
1009
def set_linewidth (self , w ):
Original file line number Diff line number Diff line change @@ -130,6 +130,19 @@ def test_valid_drawstyles():
130
130
line .set_drawstyle ('foobar' )
131
131
132
132
133
+ def test_set_drawstyle ():
134
+ x = np .linspace (0 , 2 * np .pi , 10 )
135
+ y = np .sin (x )
136
+
137
+ fig , ax = plt .subplots ()
138
+ line , = ax .plot (x , y )
139
+ line .set_drawstyle ("steps-pre" )
140
+ assert len (line .get_path ().vertices ) == 2 * len (x )- 1
141
+
142
+ line .set_drawstyle ("default" )
143
+ assert len (line .get_path ().vertices ) == len (x )
144
+
145
+
133
146
@image_comparison (baseline_images = ['line_collection_dashes' ], remove_text = True )
134
147
def test_set_line_coll_dash_image ():
135
148
fig = plt .figure ()
You can’t perform that action at this time.
0 commit comments