[Matplotlib-users] Arc and art3d.pathpatch_2d_to_3d
Andreas Schneider
andreas_schn at web.de
Wed Apr 22 04:33:26 EDT 2020
Hi,
I'm trying to plot an arc in a 3d plot using patches.Arc and
art3d.pathpatch_2d_to_3d. However, although the arc is correctly shown
from theta1 to theta2 in a 2d plot, the 3d plot always shows the full
circle. Here is a minimal example:
from matplotlib import pyplot as plt
from matplotlib import patches
from mpl_toolkits.mplot3d import art3d
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
p = patches.Arc((0, 0), 0.5, 0.5, angle=0., theta1=0., theta2=45.)
ax.add_patch(p)
art3d.pathpatch_2d_to_3d(p, z=0, zdir="y")
plt.show()
I get a whole circle but want to have an arc only from 0 degrees to 45
degrees. A corresponding 2d plot shows the arc correctly:
fig = plt.figure()
ax = fig.add_subplot(111)
p = patches.Arc((0, 0), 0.5, 0.5, angle=0., theta1=0., theta2=45.)
ax.add_patch(p)
plt.show()
What am I doing wrong with the conversion from 2d to 3d?
I tried Python 3.7.3 with Matplotlib 3.0.2 and Python 2.7.16 with
Matplotlib 2.2.3 (which are shipped with my Linux distribution).
Thanks in advance for your help.
Andreas
More information about the Matplotlib-users
mailing list