|
46 | 46 | fromnumpy.linalgimportinv
|
47 | 47 |
|
48 | 48 | frommatplotlibimport_api
|
49 |
| -frommatplotlib._pathimport ( |
50 |
| -affine_transform,count_bboxes_overlapping_bbox,update_path_extents) |
| 49 | +frommatplotlib._pathimportaffine_transform,count_bboxes_overlapping_bbox |
51 | 50 | from .pathimportPath
|
52 | 51 |
|
53 | 52 | DEBUG=False
|
@@ -868,10 +867,35 @@ def update_from_path(self, path, ignore=None, updatex=True, updatey=True):
|
868 | 867 | ifpath.vertices.size==0:
|
869 | 868 | return
|
870 | 869 |
|
871 |
| -points,minpos,changed=update_path_extents( |
872 |
| -path,None,self._points,self._minpos,ignore) |
| 870 | +ifignore: |
| 871 | +points=np.array([[np.inf,np.inf], [-np.inf,-np.inf]]) |
| 872 | +minpos=np.array([np.inf,np.inf]) |
| 873 | +else: |
| 874 | +points=self._points.copy() |
| 875 | +minpos=self._minpos.copy() |
| 876 | + |
| 877 | +ifupdatexandupdatey: |
| 878 | +where= (np.isfinite(path.vertices[...,0]) |
| 879 | +&np.isfinite(path.vertices[...,1])) |
| 880 | +elifupdatex: |
| 881 | +where=np.isfinite(path.vertices[...,0]) |
| 882 | +elifupdatey: |
| 883 | +where=np.isfinite(path.vertices[...,1]) |
| 884 | +else: |
| 885 | +return |
873 | 886 |
|
874 |
| -ifchanged: |
| 887 | +ifupdatex: |
| 888 | +x=path.vertices[...,0][where] |
| 889 | +points[0,0]=min(points[0,0],np.min(x,initial=np.inf)) |
| 890 | +points[1,0]=max(points[1,0],np.max(x,initial=-np.inf)) |
| 891 | +minpos[0]=min(minpos[0],np.min(x[x>0],initial=np.inf)) |
| 892 | +ifupdatey: |
| 893 | +y=path.vertices[...,1][where] |
| 894 | +points[0,1]=min(points[0,1],np.min(y,initial=np.inf)) |
| 895 | +points[1,1]=max(points[1,1],np.max(y,initial=-np.inf)) |
| 896 | +minpos[1]=min(minpos[1],np.min(y[y>0],initial=np.inf)) |
| 897 | + |
| 898 | +ifnp.any(points!=self._points)ornp.any(minpos!=self._minpos): |
875 | 899 | self.invalidate()
|
876 | 900 | ifupdatex:
|
877 | 901 | self._points[:,0]=points[:,0]
|
|