Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e70e8b2

Browse files
committed
FIX: logic error with cmap
1 parent 662890a commit e70e8b2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,15 +1234,17 @@ def __init__(self, x, y, z, dxy='0.8', z0=0, shade=True, lightsource=None,
12341234
self._lightsource = lightsource
12351235

12361236
COLOR_KWS = {'color', 'facecolor', 'facecolors'}
1237-
if not (no_cmap := (cmap is None)) and (ckw := COLOR_KWS.intersection(kws)):
1238-
warnings.warn(f'Ignoring cmap since {ckw!r} provided.')
1239-
kws.pop('cmap', None)
1237+
if cmap is not None:
1238+
if (ckw := COLOR_KWS.intersection(kws)):
1239+
warnings.warn(f'Ignoring cmap since {ckw!r} provided.')
1240+
else:
1241+
kws.update(cmap=cmap)
12401242

12411243
# init Poly3DCollection
12421244
# rectangle side panel vertices
12431245
Poly3DCollection.__init__(self, self._compute_verts(), **kws)
12441246

1245-
if not no_cmap:
1247+
if cmap:
12461248
self.set_array(self.z.ravel())
12471249

12481250
def _resolve_dx_dy(self, dxy):
@@ -1445,7 +1447,7 @@ class HexBar3DCollection(Bar3DCollection):
14451447
def _compute_verts(self):
14461448

14471449
# scale the base hexagon
1448-
hexagon = np.array([self.dx, self.dy * np.sqrt(3)]).T * HEXAGON
1450+
hexagon = np.array([self.dx, self.dy / np.sqrt(3)]).T * HEXAGON
14491451
xy_pairs = np.moveaxis([hexagon, np.roll(hexagon, -1, 0)], 0, 1)
14501452
xy_sides = xy_pairs[np.newaxis] + self.xy[:, None, None].T # (n,6,2,2)
14511453

0 commit comments

Comments
 (0)