Skip to content

3D bar chart with shading is rendered incorrectly #13728

@sazas

Description

@sazas

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

image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    keepItems to be ignored by the “Stale” Github Actiontopic: mplot3d

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy