@@ -990,8 +990,32 @@ def set_path(self, path):
990990
991991
992992class StepPatch (PathPatch ):
993+ """A stepline path patch."""
994+
995+ @docstring .dedent_interpd
993996 def __init__ (self , vals , bins = None , * ,
994997 orientation = 'horizontal' , baseline = 0 , ** kwargs ):
998+ """
999+ Parameters
1000+ ----------
1001+ vals : array, len N
1002+ An array of y-values.
1003+
1004+ bins : array, len N+1
1005+ A array of x-values, between which the curve takes on
1006+ vals values.
1007+
1008+ orientation : {'vertical', 'horizontal'}, default: 'vertical'
1009+
1010+ baseline : float or None, default: 0
1011+ Determines starting value of the bounding edges or when
1012+ "fill" == True, position of lower edge.
1013+
1014+ **kwargs
1015+ `Patch` properties:
1016+
1017+ %(Patch)s
1018+ """
9951019 self .baseline = baseline
9961020 self .orientation = orientation
9971021 self ._bins = bins
@@ -1005,9 +1029,9 @@ def _update_data(self):
10051029 raise ValueError ('the length of the bins is wrong' )
10061030 verts , codes = [], []
10071031 for idx0 , idx1 in cbook .contiguous_regions (~ np .isnan (self ._vals )):
1008- x = np .vstack ((self ._bins [idx0 :idx1 + 1 ],
1032+ x = np .vstack ((self ._bins [idx0 :idx1 + 1 ],
10091033 self ._bins [idx0 :idx1 + 1 ])).T .flatten ()
1010- y = np .vstack ((self ._vals [idx0 :idx1 ],
1034+ y = np .vstack ((self ._vals [idx0 :idx1 ],
10111035 self ._vals [idx0 :idx1 ])).T .flatten ()
10121036 if self .baseline is not None :
10131037 y = np .hstack ((self .baseline , y , self .baseline ))
@@ -1129,46 +1153,6 @@ def set_xy(self, xy):
11291153 doc = 'The vertices of the path as (N, 2) numpy array.' )
11301154
11311155
1132- class HistLine (Polygon ):
1133-
1134- def __init__ (self , vals , bins = None , * , fill = False ,
1135- orientation = 'horizontal' , baseline = 0 , ** kwargs ):
1136- self .baseline = baseline
1137- self .orientation = orientation
1138- self ._color = None
1139- self ._bins = bins
1140- self ._vals = vals
1141- xy = self ._update_data ()
1142- super (HistLine , self ).__init__ (xy , closed = False , fill = fill , ** kwargs )
1143-
1144- def _update_data (self ):
1145- if self ._bins .size - 1 != self ._vals .size :
1146- raise ValueError ('the length of the bins is wrong' )
1147- x = np .vstack ((self ._bins , self ._bins )).T .flatten ()
1148- y = np .vstack ((self ._vals , self ._vals )).T .flatten ()
1149- if self .baseline is not None :
1150- y = np .hstack ((self .baseline , y , self .baseline ))
1151- else :
1152- y = np .hstack ((y [0 ], y , y [- 1 ]))
1153- if self .orientation == 'horizontal' :
1154- return np .vstack ([x , y ]).T
1155- else :
1156- return np .vstack ([y , x ]).T
1157-
1158- def set_bins (self , bins ):
1159- self ._bins = bins
1160- self ._update_data ()
1161-
1162- def set_vals (self , vals ):
1163- self ._vals = vals
1164- self ._update_data ()
1165-
1166- def set_vals_bins (self , vals , bins ):
1167- self ._vals = vals
1168- self ._bins = bins
1169- self ._update_data ()
1170-
1171-
11721156class Wedge (Patch ):
11731157 """Wedge shaped patch."""
11741158
0 commit comments