3D Static and Animated Orbits

Learn how to plot 3D static and animated orbits.

Now, you need to tackle the 3D plot.

Graphing in 3 dimensions is a little more complicated, but you already have the Z coordinates of the orbits you have previously ignored. You will need to call a 3D axis projection and plot with the axis object, not with plt. You also need to take care to supply coordinates as something that is array-like. This will not be a problem for graphing the coordinates of the orbit, but it might be a problem when trying to plot a specific point like the Earth (0, 0, 0) or perigee. Also, be sure to supply the third coordinate when calling the plot() method. You want three dimensions, after all. You need to change the code to get rid of the tick marks on the 3D planes, and you need to reset the style to default.

Get hands-on with 1200+ tech skills courses.