I have two orbits which occur at different heights. I plot them in 3D, but I wish to join them together with a surface. So far I have this picture:
which I get usi
You'll want to find the equation for the line connecting the ith point in the first orbit to the ith point in the second orbit. Then you can use i and z as parameters, varying over all the possible values to find X and Y.
Example:
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
Z1 = 8.0
Z2 = 9.0
font = {'size' : 18}
matplotlib.rc('font', **font)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
t = np.linspace(0, 2 * np.pi, 100)
x = np.cos(t)
y = np.sin(2 * t)
N = len(x)
z = np.zeros(N)
z[:,] = Z1
t = np.linspace(0, 2 * np.pi, 100)
x2 = 2 * np.cos(t)
y2 = 2 * np.sin(2*t)
N = len(x2)
z2 = np.zeros(N)
z2[:,] = Z2
#Plot the first orbit
ax.plot(x, y, z, 'k-', linewidth=3.0)
#Plot second orbit
ax.plot(x2, y2, z2, 'k-', linewidth=3.0)
i, h = np.meshgrid(np.arange(len(x)), np.linspace(Z1, Z2, 10))
X = (x2[i] - x[i]) / (Z2 - Z1) * (h - Z1) + x[i]
Y = (y2[i] - y[i]) / (Z2 - Z1) * (h - Z1) + y[i]
surf = ax.plot_surface(X, Y, h, color='m', alpha=0.3,
linewidth=0)
#Set axis and things
ax.set_xticks([1.0,1.5,2])
ax.set_yticks([32,35,38])
ax.set_ylabel('$||u||_{2}$', fontsize=26, rotation=0, labelpad = 26)
ax.set_xlabel('$h$', fontsize=26)
ax.set_zlabel('$\mu$', fontsize=26, rotation=90)
plt.tight_layout()
plt.show()