User Tools

Site Tools


Sidebar

Predmety

Zariadenia

Users

python:plot_wireframe
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d.axes3d import Axes3D
 
x = np.linspace(-5, 5, 10)
y = np.array([-5,-4,-3,-2,1,4,7])
#y = np.linspace(-5, 5, 20)**3
 
## 1.
#x,y = np.meshgrid(x,y)
 
## 2.
#x = x[:,np.newaxis]
#y = y[np.newaxis]
 
## 3.
x,y = np.mgrid[-5:5:10j, -5:5:20j]
 
## 4.
#x,y = np.ogrid[-5:5:10j, -5:5:20j]
 
z = np.sin(np.hypot(x,y))
 
print x.shape
print y.shape
print z.shape
 
ax = plt.gca(projection='3d')
ax.plot_wireframe(x, y, z)
plt.show()
python/plot_wireframe.txt · Last modified: 2021/10/25 08:53 (external edit)