João Renato
João Renato

Reputation: 1

Parametrized surface plot in matplotlib

so I've been trying to plot this surface, that is parametrized in disk-cyclide coordinates:

parametric functions

Lambda function

But I've been getting an error saying that Z must be 2 dimensional. How can I make it that way while it is parametrized by 3 variables?

Using this code:

size = 250    
psi = np.linspace(0, 2*np.pi, size)
mu = np.linspace(0,K, size)
nu =  np.linspace(0, Kl, size)
Mu, Nu, Psi = np.meshgrid(mu, nu, psi)

k = 0.963
kl = 0.270

K = sp.special.ellipk(k)

Kl = sp.special.ellipk(kl)


Lambda = 1 - (sp.special.ellipj(Mu,k)[2]**2)*(sp.special.ellipj(Nu,kl)[0])

x = (1/Lambda)*(sp.special.ellipj(Mu,k)[1])*(sp.special.ellipj(Nu,kl)[1])*np.cos(Psi)

y = (a/Lambda)*(sp.special.ellipj(Mu,k)[1])*(sp.special.ellipj(Nu,kl)[1])*np.sin(Psi)

z = (a/Lambda)*(sp.special.ellipj(Mu,k)[0])*(sp.special.ellipj(Mu,k)[2])*(sp.special.ellipj(Nu,kl)[0])*(sp.special.ellipj(Nu,kl)[2])

fig = plt.figure()
ax = fig.gca(projection = '3d')

ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap="hot")
plt.show()   

Upvotes: 0

Views: 129

Answers (0)

Related Questions