|
22 | 22 | import matplotlib.image as mimage
|
23 | 23 | import matplotlib.lines as mlines
|
24 | 24 | import matplotlib.patches as mpatches
|
25 |
| -import matplotlib.path as mpath |
26 | 25 | from matplotlib.rcsetup import cycler, validate_axisbelow
|
27 | 26 | import matplotlib.spines as mspines
|
28 | 27 | import matplotlib.table as mtable
|
@@ -2374,10 +2373,18 @@ def _update_patch_limits(self, patch):
|
2374 | 2373 | ((not patch.get_width()) and (not patch.get_height()))):
|
2375 | 2374 | return
|
2376 | 2375 | p = patch.get_path()
|
2377 |
| - vertices = p.vertices if p.codes is None else p.vertices[np.isin( |
2378 |
| - p.codes, (mpath.Path.CLOSEPOLY, mpath.Path.STOP), invert=True)] |
2379 |
| - if not vertices.size: |
2380 |
| - return |
| 2376 | + # Get all vertices on the path |
| 2377 | + # Loop through each sement to get extrema for Bezier curve sections |
| 2378 | + vertices = [] |
| 2379 | + for curve, code in p.iter_bezier(): |
| 2380 | + # Get distance along the curve of any extrema |
| 2381 | + _, dzeros = curve.axis_aligned_extrema() |
| 2382 | + # Calculate vertcies of start, end and any extrema in between |
| 2383 | + vertices.append(curve([0, *dzeros, 1])) |
| 2384 | + |
| 2385 | + if len(vertices): |
| 2386 | + vertices = np.row_stack(vertices) |
| 2387 | + |
2381 | 2388 | patch_trf = patch.get_transform()
|
2382 | 2389 | updatex, updatey = patch_trf.contains_branch_seperately(self.transData)
|
2383 | 2390 | if not (updatex or updatey):
|
|
0 commit comments