@@ -2357,19 +2357,28 @@ def _update_patch_limits(self, patch):
2357
2357
((not patch .get_width ()) and (not patch .get_height ()))):
2358
2358
return
2359
2359
p = patch .get_path ()
2360
- vertices = p .vertices if p .codes is None else p .vertices [np .isin (
2361
- p .codes , (mpath .Path .CLOSEPOLY , mpath .Path .STOP ), invert = True )]
2362
- if vertices .size > 0 :
2363
- xys = patch .get_patch_transform ().transform (vertices )
2364
- if patch .get_data_transform () != self .transData :
2365
- patch_to_data = (patch .get_data_transform () -
2366
- self .transData )
2367
- xys = patch_to_data .transform (xys )
2368
-
2369
- updatex , updatey = patch .get_transform ().\
2370
- contains_branch_seperately (self .transData )
2371
- self .update_datalim (xys , updatex = updatex ,
2372
- updatey = updatey )
2360
+ # Get all vertices on the path
2361
+ # Loop through each sement to get extrema (as opposed to control points)
2362
+ # for Bezier curve sections
2363
+ vertices = []
2364
+ for curve , code in p .iter_bezier ():
2365
+ _ , dzeros = curve .axis_aligned_extrema ()
2366
+ # as can the ends of the curve
2367
+ vertices .append (curve ([0 , * dzeros , 1 ]))
2368
+
2369
+ if len (vertices ):
2370
+ vertices = np .row_stack (vertices )
2371
+
2372
+ xys = patch .get_patch_transform ().transform (vertices )
2373
+ if patch .get_data_transform () != self .transData :
2374
+ patch_to_data = (patch .get_data_transform () -
2375
+ self .transData )
2376
+ xys = patch_to_data .transform (xys )
2377
+
2378
+ updatex , updatey = patch .get_transform ().\
2379
+ contains_branch_seperately (self .transData )
2380
+ self .update_datalim (xys , updatex = updatex ,
2381
+ updatey = updatey )
2373
2382
2374
2383
def add_table (self , tab ):
2375
2384
"""
0 commit comments