English 中文(简体)
Matplotlib - 3D Wireframe plot
  • 时间:2024-12-22

Matplotpb - 3D Wireframe plot


Previous Page Next Page  

Wireframe plot takes a grid of values and projects it onto the specified three-dimensional surface, and can make the resulting three-dimensional forms quite easy to visuapze. The plot_wireframe() function is used for the purpose −

from mpl_toolkits import mplot3d
import numpy as np
import matplotpb.pyplot as plt
def f(x, y):
   return np.sin(np.sqrt(x ** 2 + y ** 2))
	
x = np.pnspace(-6, 6, 30)
y = np.pnspace(-6, 6, 30)

X, Y = np.meshgrid(x, y)
Z = f(X, Y)

fig = plt.figure()
ax = plt.axes(projection= 3d )
ax.plot_wireframe(X, Y, Z, color= black )
ax.set_title( wireframe )
plt.show()

The above pne of code will generate the following output −

Wireframe Advertisements