@@ -1113,7 +1113,7 @@ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid',
1113
1113
@_preprocess_data (replace_names = ["x" , "ymin" , "ymax" , "colors" ],
1114
1114
label_namer = "x" )
1115
1115
def vlines (self , x , ymin , ymax , colors = None , linestyles = 'solid' ,
1116
- label = '' , ** kwargs ):
1116
+ label = '' , transform = None , ** kwargs ):
1117
1117
"""
1118
1118
Plot vertical lines at each *x* from *ymin* to *ymax*.
1119
1119
@@ -1173,18 +1173,30 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
1173
1173
1174
1174
lines = mcoll .LineCollection (masked_verts , colors = colors ,
1175
1175
linestyles = linestyles , label = label )
1176
+ if transform is not None :
1177
+ lines .set_transform (transform )
1176
1178
self .add_collection (lines , autolim = False )
1179
+ self ._unstale_viewLim ()
1177
1180
lines ._internal_update (kwargs )
1178
1181
1179
1182
if len (x ) > 0 :
1180
1183
# Extreme values of x/ymin/ymax. Using masked_verts here handles
1181
1184
# the case of x being a masked *object* array (as can be generated
1182
1185
# e.g. by errorbar()), which would make nanmin/nanmax stumble.
1183
- minx = np .nanmin (masked_verts [..., 0 ])
1184
- maxx = np .nanmax (masked_verts [..., 0 ])
1185
- miny = np .nanmin (masked_verts [..., 1 ])
1186
- maxy = np .nanmax (masked_verts [..., 1 ])
1187
- corners = (minx , miny ), (maxx , maxy )
1186
+ if self .name == "polar" :
1187
+ minx = np .nanmin (masked_verts [..., 0 ])
1188
+ maxx = np .nanmax (masked_verts [..., 0 ])
1189
+ miny = np .nanmin (masked_verts [..., 1 ])
1190
+ maxy = np .nanmax (masked_verts [..., 1 ])
1191
+ corners = (minx , miny ), (maxx , maxy )
1192
+ else :
1193
+ datalim = lines .get_datalim (self .transData )
1194
+ minx = np .nanmin (datalim .xmin )
1195
+ maxx = np .nanmax (datalim .xmax )
1196
+ miny = np .nanmin (datalim .ymin )
1197
+ maxy = np .nanmax (datalim .ymax )
1198
+ corners = (minx , miny ), (maxx , maxy )
1199
+
1188
1200
self .update_datalim (corners )
1189
1201
self ._request_autoscale_view ()
1190
1202
0 commit comments