@@ -1258,12 +1258,14 @@ def set_verts_and_codes(self, verts, codes):
1258
1258
class FillBetweenPolyCollection (PolyCollection ):
1259
1259
def __init__ (
1260
1260
self , t_direction , t , f1 , f2 , * ,
1261
- where = None , interpolate = False , step = None , _axes = None , ** kwargs ):
1261
+ where = None , interpolate = False , step = None , axes = None , ** kwargs ):
1262
1262
self .t_direction = t_direction
1263
- kwargs = self ._normalise_kwargs (_axes , ** kwargs )
1263
+ kwargs = self ._normalise_kwargs (axes , ** kwargs )
1264
1264
polys = self ._make_verts (
1265
- t , f1 , f2 , where , interpolate , step , _axes , ** kwargs )
1265
+ t , f1 , f2 , where , interpolate , step , axes , ** kwargs )
1266
1266
super ().__init__ (polys , ** kwargs )
1267
+ if axes is not None :
1268
+ self ._update_axes_datalim (axes , kwargs .get ("transform" ))
1267
1269
1268
1270
@property
1269
1271
def _f_direction (self ):
@@ -1317,9 +1319,6 @@ def _make_verts(self, t, f1, f2, where, interpolate, step, axes, **kwargs):
1317
1319
self ._pts = self ._normalise_pts (np .vstack ([
1318
1320
np .hstack ([t [where , None ], dep [where , None ]]) for dep in (f1 , f2 )]))
1319
1321
1320
- if "transform" in kwargs :
1321
- self ._up_xy = kwargs ["transform" ].contains_branch_seperately
1322
-
1323
1322
return polys
1324
1323
1325
1324
def _normalise_kwargs (self , axes , ** kwargs ):
@@ -1385,6 +1384,13 @@ def _get_interp_point(self, t, f1, f2, idx):
1385
1384
def _normalise_pts (self , pts ):
1386
1385
return pts [:, ::- 1 ] if self .t_direction == "y" else pts
1387
1386
1387
+ def _update_axes_datalim (self , axes , transform ):
1388
+ """Update the datalim and autoscale."""
1389
+ if transform is not None :
1390
+ up_x , up_y = transform .contains_branch_seperately (axes .transData )
1391
+ else :
1392
+ up_x = up_y = True
1393
+ axes .update_datalim (self ._pts , updatex = up_x , updatey = up_y )
1388
1394
1389
1395
class RegularPolyCollection (_CollectionWithSizes ):
1390
1396
"""A collection of n-sided regular polygons."""
0 commit comments