Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6cca7ba

Browse files
authored
Merge pull request#29831 from anntzer/cefp
Inline _calc_extents_from_path.
2 parents77993d5 +4d25db2 commit6cca7ba

File tree

1 file changed

+9
-41
lines changed

1 file changed

+9
-41
lines changed

‎lib/matplotlib/transforms.py

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -867,53 +867,16 @@ def update_from_path(self, path, ignore=None, updatex=True, updatey=True):
867867
ifignoreisNone:
868868
ignore=self._ignore
869869

870-
ifpath.vertices.size==0:
870+
ifpath.vertices.size==0ornot (updatexorupdatey):
871871
return
872872

873-
points,minpos,changed=self._calc_extents_from_path(path,ignore,
874-
updatex,updatey)
875-
876-
ifchanged:
877-
self.invalidate()
878-
ifupdatex:
879-
self._points[:,0]=points[:,0]
880-
self._minpos[0]=minpos[0]
881-
ifupdatey:
882-
self._points[:,1]=points[:,1]
883-
self._minpos[1]=minpos[1]
884-
885-
def_calc_extents_from_path(self,path,ignore,updatex=True,updatey=True):
886-
"""
887-
Calculate the new bounds and minimum positive values for a `Bbox` from
888-
the path.
889-
890-
Parameters
891-
----------
892-
path : `~matplotlib.path.Path`
893-
ignore : bool
894-
- When ``True``, ignore the existing bounds of the `Bbox`.
895-
- When ``False``, include the existing bounds of the `Bbox`.
896-
updatex : bool
897-
When ``True``, update the x-values.
898-
updatey : bool
899-
When ``True``, update the y-values.
900-
901-
Returns
902-
-------
903-
points : (2, 2) array
904-
minpos : (2,) array
905-
changed : bool
906-
"""
907873
ifignore:
908874
points=np.array([[np.inf,np.inf], [-np.inf,-np.inf]])
909875
minpos=np.array([np.inf,np.inf])
910876
else:
911877
points=self._points.copy()
912878
minpos=self._minpos.copy()
913879

914-
ifnot (updatexorupdatey):
915-
returnpoints,minpos,False
916-
917880
valid_points= (np.isfinite(path.vertices[...,0])
918881
&np.isfinite(path.vertices[...,1]))
919882

@@ -928,9 +891,14 @@ def _calc_extents_from_path(self, path, ignore, updatex=True, updatey=True):
928891
points[1,1]=max(points[1,1],np.max(y,initial=-np.inf))
929892
minpos[1]=min(minpos[1],np.min(y[y>0],initial=np.inf))
930893

931-
changed=np.any(points!=self._points)ornp.any(minpos!=self._minpos)
932-
933-
returnpoints,minpos,changed
894+
ifnp.any(points!=self._points)ornp.any(minpos!=self._minpos):
895+
self.invalidate()
896+
ifupdatex:
897+
self._points[:,0]=points[:,0]
898+
self._minpos[0]=minpos[0]
899+
ifupdatey:
900+
self._points[:,1]=points[:,1]
901+
self._minpos[1]=minpos[1]
934902

935903
defupdate_from_data_x(self,x,ignore=None):
936904
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp