Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix get_path for 3d artists #27440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,11 @@ def set_3d_properties(self, verts, zs=0, zdir='z'):
for ((x, y), z) in zip(verts, zs)]

def get_path(self):
# docstring inherited
# self._path2d is not initialized until do_3d_projection
if not hasattr(self, '_path2d'):
self.axes.M = self.axes.get_proj()
self.do_3d_projection()
return self._path2d

def do_3d_projection(self):
Expand Down
10 changes: 10 additions & 0 deletions lib/mpl_toolkits/mplot3d/tests/test_axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -2112,6 +2112,16 @@ def test_scatter_spiral():
fig.canvas.draw()


def test_Poly3DCollection_get_path():
# Smoke test to see that get_path does not raise
# See GH#27361
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
p = Circle((0, 0), 1.0)
ax.add_patch(p)
art3d.pathpatch_2d_to_3d(p)
p.get_path()


def test_Poly3DCollection_get_facecolor():
# Smoke test to see that get_facecolor does not raise
# See GH#4067
Expand Down