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

Arc and pathpatch_2d_to_3d plots full ellipse · Issue #19550 · matplotlib/matplotlib · GitHub

Repository navigation

Arc and pathpatch_2d_to_3d plots full ellipse #19550

Closed

Description

Bug report

Bug summary

I'm trying to draw an arc with an arrow in a 3D plot (to visualize an angle) and am having trouble using pathpatch_2d_to_3d. The full circle is displayed when a 3D figure is used.

I found https://discourse.matplotlib.org/t/matplotlib-users-arc-and-art3d-pathpatch-2d-to-3d/21104, which is the exact same issue.
What's the best way to achieve the desired outcome?

Code for reproduction

import matplotlib.pyplot as plt
from matplotlib.patches import Arc
import mpl_toolkits.mplot3d.art3d as art3d

fig = plt.figure()
ax = plt.axes(projection='3d')
a = Arc((0.5, 0.5), width=0.5, height=0.5, angle=0, theta1=0, theta2=90)
ax.add_patch(a)
art3d.pathpatch_2d_to_3d(a, z=0, zdir='z')
plt.show()

Actual outcome

Expected outcome

I expect the arc to be 90 degrees, not a full circle.

Matplotlib version
Matplotlib 3.3.4 w/ Python 3.9.1.

Activity

  1. timhoffm commented on Feb 28, 2021

    Member

    The problem is the internal representation of the Arc: It's path is an ellipse (actually a transformed circle). The angles are stored and used in Arc.draw() to limit drawing to the correct ellipse segment. pathpatch_2d_to_3d transforms the path, but the segment cut-out in draw does not work for the transformed path.

  2. alspitz commented on Feb 28, 2021

    Author

    I can get it to at least display the right arc by adding
    self._path = Path.arc(theta1, theta2)
    after the Ellipse constructor call in the Arc constructor, though not sure if this messes with the 2D drawing logic (and it won't handle the errors in the approximation in case they are visible like draw does).

  3. added this to the v3.6.0 milestone on Aug 20, 2022
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL