1

I have a simple ellipse projected to 3D from 2D.

from matplotlib.patches import Ellipse
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.art3d as art3d    
fig = plt.figure(figsize=(10,8))
ax = fig.add_subplot(111, projection='3d')
p= Ellipse(xy=(6000,7000), width=2000, height=150,edgecolor='b',  fc='b', lw=2)
ax.add_patch(p)
art3d.pathpatch_2d_to_3d(p, z=5000, zdir="x")
ax.set_xlim(0, 12500)
ax.set_ylim(0, 12500)
ax.set_zlim(6500, 7600)
plt.show()

The result is shown below

enter image description here

How do I try and rotate the ellipse in 3D in the xy plane. The "angle" argument in ellipse seems to revolve the ellipse as not rotate with an azimuth. Any pointers?

Dark Knight
  • 153
  • 11
  • I don't know of any easy way to achieve this (that does not mean, there is none). Be reminded that matplotlib is a 2D plotting library that was extended into 3D plotting. It is no a substitute for programs like Mayavi. But here is a solution to your problem: https://stackoverflow.com/q/18228966/8881141 – Mr. T Dec 19 '20 at 13:41
  • 1
    Thanks.. I was able to solve this using the solution you pointed to .. – Dark Knight Dec 19 '20 at 17:29

0 Answers0