10000 Merge pull request #6990 from tacaswell/fix_bar3D_dflt_color · matplotlib/matplotlib@5e038b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5e038b5

Browse files
authored
Merge pull request #6990 from tacaswell/fix_bar3D_dflt_color
FIX: default color handling in bar3D
2 parents 6ca5ad8 + e0dbfdf commit 5e038b5

File tree

2 files changed

+16
-3
lines changed
Expand file tree

2 files changed

+16
-3
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,9 +2443,9 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None,
24432443

24442444
facecolors = []
24452445
if color is None:
2446-
# no color specified
2447-
facecolors = [None] * len(x)
2448-
elif len(color) == len(x):
2446+
color = [self._get_lines.get_next_color()]
2447+
2448+
if len(color) == len(x):
24492449
# bar colors specified, need to expand to number of faces
24502450
for c in color:
24512451
facecolors.extend([c] * 6)

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ def test_bar3d():
2020
ax.bar(xs, ys, zs=z, zdir='y', color=cs, alpha=0.8)
2121

2222

23+
@cleanup
24+
def test_bar3d_dflt_smoke():
25+
fig = plt.figure()
26+
ax = fig.add_subplot(111, projection='3d')
27+
x = np.arange(4)
28+
y = np.arange(5)
29+
x2d, y2d = np.meshgrid(x, y)
30+
x2d, y2d = x2d.ravel(), y2d.ravel()
31+
z = x2d + y2d
32+
ax.bar3d(x2d, y2d, x2d * 0, 1, 1, z)
33+
fig.canvas.draw()
34+
35+
2336
@image_comparison(baseline_images=['contour3d'], remove_text=True)
2437
def test_contour3d():
2538
fig = plt.figure()

0 commit comments

Comments
 (0)
0