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

Commit74543da

Browse files
More code review updates
1 parenta8e290a commit74543da

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

‎lib/matplotlib/transforms.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,8 @@ def update_from_data_x(self, x, ignore=None):
945945
- When ``None``, use the last value passed to :meth:`ignore`.
946946
"""
947947
x=np.ravel(x)
948+
# The y-component in np.array([x, *y*]).T is not used. We simply pass
949+
# x again to not spend extra time on creating an array of unused data
948950
self.update_from_data_xy(np.array([x,x]).T,ignore=ignore,updatey=False)
949951

950952
defupdate_from_data_y(self,y,ignore=None):
@@ -963,6 +965,8 @@ def update_from_data_y(self, y, ignore=None):
963965
- When ``None``, use the last value passed to :meth:`ignore`.
964966
"""
965967
y=np.ravel(y)
968+
# The x-component in np.array([*x*, y]).T is not used. We simply pass
969+
# y again to not spend extra time on creating an array of unused data
966970
self.update_from_data_xy(np.array([y,y]).T,ignore=ignore,updatex=False)
967971

968972
defupdate_from_data_xy(self,xy,ignore=None,updatex=True,updatey=True):

‎lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,29 +2413,34 @@ def plot_wireframe(self, X, Y, Z, *, axlim_clip=False, **kwargs):
24132413
rstride=int(max(np.ceil(rows/rcount),1))ifrcountelse0
24142414
cstride=int(max(np.ceil(cols/ccount),1))ifccountelse0
24152415

2416+
ifrstride==0andcstride==0:
2417+
raiseValueError("Either rstride or cstride must be non zero")
2418+
24162419
# We want two sets of lines, one running along the "rows" of
24172420
# Z and another set of lines running along the "columns" of Z.
24182421
# This transpose will make it easy to obtain the columns.
24192422
tX,tY,tZ=np.transpose(X),np.transpose(Y),np.transpose(Z)
24202423

2421-
ifrstride:
2424+
# Compute the indices of the row and column lines to be drawn
2425+
ifrstride==0:
2426+
rii=np.array([],dtype=int)
2427+
elif (rows-1)%rstride==0:
2428+
# last index is hit: rii[-1] == rows - 1
24222429
rii=np.arange(0,rows,rstride)
2423-
# Add the last index only if needed
2424-
ifrows>0andrii[-1]!= (rows-1):
2425-
rii=np.append(rii,rows-1)
24262430
else:
2427-
rii=np.array([],dtype=int)
2431+
# add the last index
2432+
rii=np.arange(0,rows+rstride,rstride)
2433+
rii[-1]=rows-1
24282434

2429-
ifcstride:
2435+
ifcstride==0:
2436+
cii=np.array([],dtype=int)
2437+
elif (cols-1)%cstride==0:
2438+
# last index is hit: cii[-1] == cols - 1
24302439
cii=np.arange(0,cols,cstride)
2431-
# Add the last index only if needed
2432-
ifcols>0andcii[-1]!= (cols-1):
2433-
cii=np.append(cii,cols-1)
24342440
else:
2435-
cii=np.array([],dtype=int)
2436-
2437-
ifrstride==0andcstride==0:
2438-
raiseValueError("Either rstride or cstride must be non zero")
2441+
# add the last index
2442+
cii=np.arange(0,cols+cstride,cstride)
2443+
cii[-1]=cols-1
24392444

24402445
# If the inputs were empty, then just
24412446
# reset everything.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp