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

Appearance settings

Commit 84a5a32

Browse filesBrowse files
committed
DEV: rename function
1 parent 60b91bd commit 84a5a32
Copy full SHA for 84a5a32

File tree

1 file changed

+10
-8
lines changed
Filter options

1 file changed

+10
-8
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/art3d.py
+10-8Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,8 +1204,8 @@ class Bar3DCollection(Poly3DCollection):
12041204

12051205
_n_faces = 6
12061206

1207-
def __init__(self, x, y, z, dxy='0.8', z0=0, shade=True, lightsource=None,
1208-
cmap=None, **kws):
1207+
def __init__(self, x, y, z, dxy='0.8', z0=0,
1208+
shade=True, lightsource=None, cmap=None, **kws):
12091209
#
12101210
x, y, z, z0 = np.ma.atleast_1d(x, y, z, z0)
12111211
assert x.shape == y.shape == z.shape
@@ -1226,15 +1226,17 @@ def __init__(self, x, y, z, dxy='0.8', z0=0, shade=True, lightsource=None,
12261226
# Shade faces by angle to light source
12271227
self._original_alpha = kws.pop('alpha', 1)
12281228
self._shade = bool(shade)
1229+
# resolve light source
12291230
if lightsource is None:
12301231
# chosen for backwards-compatibility
12311232
lightsource = CLASSIC_LIGHTSOURCE
12321233
else:
12331234
assert isinstance(lightsource, mcolors.LightSource)
12341235
self._lightsource = lightsource
12351236

1236-
COLOR_KWS = {'color', 'facecolor', 'facecolors'}
1237+
# resolve cmap
12371238
if cmap is not None:
1239+
COLOR_KWS = {'color', 'facecolor', 'facecolors'}
12381240
if (ckw := COLOR_KWS.intersection(kws)):
12391241
warnings.warn(f'Ignoring cmap since {ckw!r} provided.')
12401242
else:
@@ -1256,7 +1258,7 @@ def _resolve_dx_dy(self, dxy):
12561258
# scale dxy to data step.
12571259
# get x/y step along axis -1/-2 (x/y considered constant along axis
12581260
# -2/-1)
1259-
data_step = _get_data_step(xy, -i - 1) if isinstance(d[i], str) else 1
1261+
data_step = _get_grid_step(xy, -i - 1) if isinstance(d[i], str) else 1
12601262
d[i] = float(d[i]) * data_step
12611263

12621264
dx, dy = d
@@ -1298,7 +1300,7 @@ def set_z0(self, z0):
12981300

12991301
def set_data(self, x=None, y=None, z=None, z0=None, clim=None):
13001302
# self._xyz = np.atleast_3d(xyz)
1301-
assert not all(is_none(x, y, z, z0))
1303+
assert not all(map(is_none, (x, y, z, z0)))
13021304

13031305
if (x is not None) or (y is not None):
13041306
self._resolve_dx_dy(self.dxy)
@@ -1335,8 +1337,8 @@ def _compute_verts(self):
13351337
xyz = np.expand_dims(np.moveaxis([x, y, z], 0, -1), (-2, -3))
13361338
dxyz = np.empty_like(xyz)
13371339
dxyz[..., :2] = np.array([[[self.dx]], [[self.dy]]]).T
1338-
dxyz[..., 2] = np.array([[self.z - self.z0]]).T
1339-
polys = xyz + dxyz * CUBOID[None, :] # (n, 6, 4, 3)
1340+
dxyz[..., 2] = np.array(self.z - self.z0)[..., np.newaxis, np.newaxis]
1341+
polys = xyz + dxyz * CUBOID[np.newaxis, :] # (n, 6, 4, 3)
13401342

13411343
# collapse the first two axes
13421344
return polys.reshape((-1, 4, 3)) # *polys.shape[-2:]
@@ -1657,7 +1659,7 @@ def _camera_position(ax):
16571659
return r, theta, phi
16581660

16591661

1660-
def _get_data_step(x, axis=0):
1662+
def _get_grid_step(x, axis=0):
16611663
# for data arrange in a regular grid, get the size of the data step by
16621664
# looking for the first non-zero step along an axis.
16631665
# If axis is singular, return 1

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.