8000 Merge pull request #27440 from thrien/fix_path2d · matplotlib/matplotlib@2cd4a40 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2cd4a40

Browse files
authored
Merge pull request #27440 from thrien/fix_path2d
Fix get_path for 3d artists
2 parents 5b5154d + b1a7e7b commit 2cd4a40

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,11 @@ def set_3d_properties(self, verts, zs=0, zdir='z'):
448448
for ((x, y), z) in zip(verts, zs)]
449449

450450
def get_path(self):
451+
# docstring inherited
452+
# self._path2d is not initialized until do_3d_projection
453+
if not hasattr(self, '_path2d'):
454+
self.axes.M = self.axes.get_proj()
455+
self.do_3d_projection()
451456
return self._path2d
452457

453458
def do_3d_projection(self):

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,6 +2112,16 @@ def test_scatter_spiral():
21122112
fig.canvas.draw()
21132113

21142114

2115+
def test_Poly3DCollection_get_path():
2116+
# Smoke test to see that get_path does not raise
2117+
# See GH#27361
2118+
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
2119+
p = Circle((0, 0), 1.0)
2120+
ax.add_patch(p)
2121+
art3d.pathpatch_2d_to_3d(p)
2122+
p.get_path()
2123+
2124+
21152125
def test_Poly3DCollection_get_facecolor():
21162126
# Smoke test to see that get_facecolor does not raise
21172127
# See GH#4067

0 commit comments

Comments
 (0)
0