Open
Description
Bug report
Bug summary
Z-order of rendered planes in 3d bar chart produced by bar3d is wrong. It is seen even in the example here https://matplotlib.org/gallery/mplot3d/3d_bars.html. One of the bars (at location 2, 4, height 6) is drawn on top of the highest bar, even though it supposed to be behind it.
Code for reproduction
A small modification of the code from example to make it more pronounced.
import numpy as np
import matplotlib.pyplot as plt
# This import registers the 3D projection, but is otherwise unused.
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
# setup the figure and axes
fig = plt.figure(figsize=(8, 8))
ax1 = fig.add_subplot(111, projection='3d')
# fake data
_x = np.arange(8)
_y = np.arange(8)
_xx, _yy = np.meshgrid(_x, _y)
x, y = _xx.ravel(), _yy.ravel()
top = x + y
bottom = np.zeros_like(top)
width = depth = 1
ax1.bar3d(x, y, bottom, width, depth, top, shade=True)
ax1.set_title('Shaded')
plt.show()
Actual outcome
Everything to the right from diagonal is rendered incorrectly.
Matplotlib version
Tested on two machines with the same results.
- Operating system: mac and windows
- Matplotlib version:
matplotlib 2.1.2 py36h6d6146d_0
and
matplotlib 3.0.3 py37_0 conda-forge - Matplotlib backend (
print(matplotlib.get_backend())
): module://ipykernel.pylab.backend_inline - Python version:
3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 13:19:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
and
3.7.1 | packaged by conda-forge | (default, Mar 13 2019, 13:32:59) [MSC v.1900 64 bit (AMD64)] - Jupyter version (if applicable):
ipython 5.1.0 py36_1
and
ipython 7.3.0 py37h39e3cac_0 conda-forge