FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

A 3D object appears in front of another object, even though it is physically behind it. · Issue #9499 · matplotlib/matplotlib · GitHub

Repository navigation

A 3D object appears in front of another object, even though it is physically behind it. #9499

Closed

Description

Bug report

Bug summary

A 3D object appears in front of another object, even though it is physically behind it.

Code for reproduction

import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.patches import Circle, Rectangle
import matplotlib.path as mpath
import matplotlib.patches as mpatches
import numpy as np
import mpl_toolkits.mplot3d.art3d as art3d
import matplotlib.pyplot as plt

mpl.rcParams['legend.fontsize'] = 10

fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_xlim(-16, 16)
ax.set_ylim(-16, 16)
ax.set_zlim(-16, 16)



for depth in [0.]:
    theta = np.linspace(-5 * np.pi, 5 * np.pi, 1000)
    x = depth * np.ones(theta.shape)
    y = theta
    z = 4 * np.cos(0.2 * theta) * np.sin(0.4 * 8 * theta)
    points = np.array([y, z]).T
    patch = mpatches.PathPatch(mpath.Path(points))
    ax.add_patch(patch)
    art3d.pathpatch_2d_to_3d(patch, z=depth, zdir='x')

for depth in range(6 ,7):
    ret = Rectangle((0-5, 0-5), 5 * 2, 5 * 2, facecolor=(depth /10, depth/10, depth/10), edgecolor=(0.,0.,0.), alpha=1.)
    ax.add_patch(ret)
    art3d.pathpatch_2d_to_3d(ret, z=depth, zdir='x')


plt.show()

Outcome

Matplotlib version

  • Operating system: Linux mercury 4.10.0-35-generic Issue38 #39-Ubuntu SMP Wed Sep 13 07:46:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Matplotlib version: 2.0.2
  • Matplotlib backend (print(matplotlib.get_backend())):Qt5Agg
  • Python version:Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58)
  • Jupyter version (if applicable):
  • Other libraries:

Activity

  1. anntzer commented on Oct 21, 2017

    Contributor

    This is a well known issue, acknowlegded and documented at http://matplotlib.org/mpl_toolkits/mplot3d/faq.html#my-3d-plot-doesn-t-look-right-at-certain-viewing-angles, and the general agreement is that it would be quite difficult to solve.
    Closing, not because we do not think the issue is unimportant, but because having another issue open on this is unlikely to change anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL