@@ -2409,39 +2409,65 @@ def bar(self, left, height, zs=0, zdir='z', *args, **kwargs):
2409
2409
return patches
2410
2410
2411
2411
def bar3d (self , x , y , z , dx , dy , dz , color = None ,
2412
- zsort = 'average' , * args , ** kwargs ):
2413
- '''
2414
- Generate a 3D bar, or multiple bars.
2415
-
2416
- When generating multiple bars, x, y, z have to be arrays.
2417
- dx, dy, dz can be arrays or scalars.
2418
-
2419
- *color* can be:
2420
-
2421
- - A single color value, to color all bars the same color.
2422
-
2423
- - An array of colors of length N bars, to color each bar
2424
- independently.
2425
-
2426
- - An array of colors of length 6, to color the faces of the
2427
- bars similarly.
2412
+ zsort = 'average' , shade = True , * args , ** kwargs ):
2413
+ """Generate a 3D barplot.
2414
+
2415
+ This method creates three dimensional barplot where the width,
2416
+ depth, height, and color of the bars can all be uniquely set.
2417
+
2418
+ Parameters
2419
+ ----------
2420
+ x, y, z : array-like
2421
+ The coordinates of the anchor point of the bars.
2422
+
2423
+ dx, dy, dz : scalar or array-like
2424
+ The width, depth, and height of the bars, respectively.
2425
+
2426
+ color : sequence of valid color specifications, optional
2427
+ The color of the bars can be specified globally or
2428
+ individually. This parameter can be:
2429
+
2430
+ - A single color value, to color all bars the same color.
2431
+ - An array of colors of length N bars, to color each bar
2432
+ independently.
2433
+ - An array of colors of length 6, to color the faces of the
2434
+ bars similarly.
2435
+ - An array of colors of length 6 * N bars, to color each face
2436
+ independently.
2437
+
2438
+ When coloring the faces of the boxes specifically, this is
2439
+ the order of the coloring:
2440
+
2441
+ 1. -Z (bottom of box)
2442
+ 2. +Z (top of box)
2443
+ 3. -Y
2444
+ 4. +Y
2445
+ 5. -X
2446
+ 6. +X
2447
+
2448
+ zsort : str, optional
2449
+ The z-axis sorting scheme passed onto
2450
+ :func:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`
2451
+
2452
+ shade : bool, optional (default = True)
2453
+ When true, this shades the dark sides of the bars (relative
2454
+ to the plot's source of light).
2455
+
2456
+ Any additional keyword arguments are passed onto
2457
+ :func:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`
2428
2458
2429
- - An array of colors of length 6 * N bars, to color each face
2430
- independently.
2459
+ Returns
2460
+ -------
2461
+ collection : Poly3DCollection
2462
+ A collection of three dimensional polygons representing
2463
+ the bars.
2431
2464
2432
- When coloring the faces of the boxes specifically, this is
2433
- the order of the coloring:
2465
+ Examples
2466
+ --------
2467
+ .. plot:: mpl_examples/mplot3d/plot_3d_bars.py
2434
2468
2435
- 1. -Z (bottom of box)
2436
- 2. +Z (top of box)
2437
- 3. -Y
2438
- 4. +Y
2439
- 5. -X
2440
- 6. +X
2469
+ """
2441
2470
2442
- Keyword arguments are passed onto
2443
- :func:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`
2444
- '''
2445
2471
had_data = self .has_data ()
2446
2472
2447
2473
if not cbook .iterable (x ):
@@ -2512,8 +2538,12 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None,
2512
2538
if len (facecolors ) < len (x ):
2513
2539
facecolors *= (6 * len (x ))
2514
2540
2515
- normals = self ._generate_normals (polys )
2516
- sfacecolors = self ._shade_colors (facecolors , normals )
2541
+ if shade :
2542
+ normals = self ._generate_normals (polys )
2543
+ sfacecolors = self ._shade_colors (facecolors , normals )
2544
+ else :
2545
+ sfacecolors = facecolors
2546
+
2517
2547
col = art3d .Poly3DCollection (polys ,
2518
2548
zsort = zsort ,
2519
2549
facecolor = sfacecolors ,
0 commit comments