@@ -1094,21 +1094,35 @@ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid',
1094
1094
1095
1095
lines = mcoll .LineCollection (masked_verts , colors = colors ,
1096
1096
linestyles = linestyles , label = label )
1097
+ if 'transform' in kwargs :
1098
+ lines .set_transform (kwargs ['transform' ])
1097
1099
self .add_collection (lines , autolim = False )
1100
+ self ._unstale_viewLim ()
1098
1101
lines ._internal_update (kwargs )
1099
1102
1100
1103
if len (y ) > 0 :
1101
1104
# Extreme values of xmin/xmax/y. Using masked_verts here handles
1102
1105
# the case of y being a masked *object* array (as can be generated
1103
1106
# e.g. by errorbar()), which would make nanmin/nanmax stumble.
1104
- minx = np .nanmin (masked_verts [..., 0 ])
1105
- maxx = np .nanmax (masked_verts [..., 0 ])
1106
- miny = np .nanmin (masked_verts [..., 1 ])
1107
- maxy = np .nanmax (masked_verts [..., 1 ])
1107
+ updatex = True
1108
+ updatey = True
1109
+ if self .name == "rectilinear" :
1110
+ datalim = lines .get_datalim (self .transData )
1111
+ t = lines .get_transform ()
1112
+ updatex , updatey = t .contains_branch_seperately (self .transData )
1113
+ minx = np .nanmin (datalim .xmin )
1114
+ maxx = np .nanmax (datalim .xmax )
1115
+ miny = np .nanmin (datalim .ymin )
1116
+ maxy = np .nanmax (datalim .ymax )
1117
+ else :
1118
+ minx = np .nanmin (masked_verts [..., 0 ])
1119
+ maxx = np .nanmax (masked_verts [..., 0 ])
1120
+ miny = np .nanmin (masked_verts [..., 1 ])
1121
+ maxy = np .nanmax (masked_verts [..., 1 ])
1122
+
1108
1123
corners = (minx , miny ), (maxx , maxy )
1109
- self .update_datalim (corners )
1124
+ self .update_datalim (corners , updatex , updatey )
1110
1125
self ._request_autoscale_view ()
1111
-
1112
1126
return lines
1113
1127
1114
1128
@_preprocess_data (replace_names = ["x" , "ymin" , "ymax" , "colors" ],
@@ -1174,21 +1188,35 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
1174
1188
1175
1189
lines = mcoll .LineCollection (masked_verts , colors = colors ,
1176
1190
linestyles = linestyles , label = label )
1191
+ if 'transform' in kwargs :
1192
+ lines .set_transform (kwargs ['transform' ])
1177
1193
self .add_collection (lines , autolim = False )
1194
+ self ._unstale_viewLim ()
1178
1195
lines ._internal_update (kwargs )
1179
1196
1180
1197
if len (x ) > 0 :
1181
1198
# Extreme values of x/ymin/ymax. Using masked_verts here handles
1182
1199
# the case of x being a masked *object* array (as can be generated
1183
1200
# e.g. by errorbar()), which would make nanmin/nanmax stumble.
1184
- minx = np .nanmin (masked_verts [..., 0 ])
1185
- maxx = np .nanmax (masked_verts [..., 0 ])
1186
- miny = np .nanmin (masked_verts [..., 1 ])
1187
- maxy = np .nanmax (masked_verts [..., 1 ])
1201
+ updatex = True
1202
+ updatey = True
1203
+ if self .name == "rectilinear" :
1204
+ datalim = lines .get_datalim (self .transData )
1205
+ t = lines .get_transform ()
1206
+ updatex , updatey = t .contains_branch_seperately (self .transData )
1207
+ minx = np .nanmin (datalim .xmin )
1208
+ maxx = np .nanmax (datalim .xmax )
1209
+ miny = np .nanmin (datalim .ymin )
1210
+ maxy = np .nanmax (datalim .ymax )
1211
+ else :
1212
+ minx = np .nanmin (masked_verts [..., 0 ])
1213
+ maxx = np .nanmax (masked_verts [..., 0 ])
1214
+ miny = np .nanmin (masked_verts [..., 1 ])
1215
+ maxy = np .nanmax (masked_verts [..., 1 ])
1216
+
1188
1217
corners = (minx , miny ), (maxx , maxy )
1189
- self .update_datalim (corners )
1218
+ self .update_datalim (corners , updatex , updatey )
1190
1219
self ._request_autoscale_view ()
1191
-
1192
1220
return lines
1193
1221
1194
1222
@_preprocess_data (replace_names = ["positions" , "lineoffsets" ,
0 commit comments