@@ -1204,8 +1204,8 @@ class Bar3DCollection(Poly3DCollection):
1204
1204
1205
1205
_n_faces = 6
1206
1206
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 ):
1209
1209
#
1210
1210
x , y , z , z0 = np .ma .atleast_1d (x , y , z , z0 )
1211
1211
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,
1226
1226
# Shade faces by angle to light source
1227
1227
self ._original_alpha = kws .pop ('alpha' , 1 )
1228
1228
self ._shade = bool (shade )
1229
+ # resolve light source
1229
1230
if lightsource is None :
1230
1231
# chosen for backwards-compatibility
1231
1232
lightsource = CLASSIC_LIGHTSOURCE
1232
1233
else :
1233
1234
assert isinstance (lightsource , mcolors .LightSource )
1234
1235
self ._lightsource = lightsource
1235
1236
1236
- COLOR_KWS = { 'color' , 'facecolor' , 'facecolors' }
1237
+ # resolve cmap
1237
1238
if cmap is not None :
1239
+ COLOR_KWS = {'color' , 'facecolor' , 'facecolors' }
1238
1240
if (ckw := COLOR_KWS .intersection (kws )):
1239
1241
warnings .warn (f'Ignoring cmap since { ckw !r} provided.' )
1240
1242
else :
@@ -1256,7 +1258,7 @@ def _resolve_dx_dy(self, dxy):
1256
1258
# scale dxy to data step.
1257
1259
# get x/y step along axis -1/-2 (x/y considered constant along axis
1258
1260
# -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
1260
1262
d [i ] = float (d [i ]) * data_step
1261
1263
1262
1264
dx , dy = d
@@ -1298,7 +1300,7 @@ def set_z0(self, z0):
1298
1300
1299
1301
def set_data (self , x = None , y = None , z = None , z0 = None , clim = None ):
1300
1302
# 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 ) ))
1302
1304
1303
1305
if (x is not None ) or (y is not None ):
1304
1306
self ._resolve_dx_dy (self .dxy )
@@ -1335,8 +1337,8 @@ def _compute_verts(self):
1335
1337
xyz = np .expand_dims (np .moveaxis ([x , y , z ], 0 , - 1 ), (- 2 , - 3 ))
1336
1338
dxyz = np .empty_like (xyz )
1337
1339
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)
1340
1342
1341
1343
# collapse the first two axes
1342
1344
return polys .reshape ((- 1 , 4 , 3 )) # *polys.shape[-2:]
@@ -1657,7 +1659,7 @@ def _camera_position(ax):
1657
1659
return r , theta , phi
1658
1660
1659
1661
1660
- def _get_data_step (x , axis = 0 ):
1662
+ def _get_grid_step (x , axis = 0 ):
1661
1663
# for data arrange in a regular grid, get the size of the data step by
1662
1664
# looking for the first non-zero step along an axis.
1663
1665
# If axis is singular, return 1
0 commit comments