-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathfonctions_surface_2.py
More file actions
42 lines (29 loc) · 892 Bytes
/
fonctions_surface_2.py
File metadata and controls
42 lines (29 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
n = 50
VX = np.linspace(-5.0, 5.0, n)
VY = np.linspace(-5.0, 5.0, n)
X,Y = np.meshgrid(VX, VY)
def f(x,y):
return x*np.sin(y)
Z = f(X,Y)
fig = plt.figure()
ax = plt.axes(projection='3d')
# Tweaking display region and labels
# ax.set_xlim(-3.0, 3.0)
# ax.set_ylim(-3.0, 3.0)
# ax.set_zlim(-0.6, 0.6)
ax.set_xlabel('axe x')
ax.set_ylabel('axe y')
ax.set_zlabel('axe z')
ax.view_init(40, -55) # a et c et e
# ax.view_init(40, -75) # b
# ax.view_init(40, -10) # d
ax.plot_wireframe(X, Y, Z, color='blue', rstride=0, cstride=2) # x = cst
ax.plot_wireframe(X, Y, Z, color='red', rstride=2, cstride=0) # y = cst
# ax.plot_wireframe(X, Y, Z, rstride=2, cstride=2) # NON : mettre les deux
# ax.plot_surface(X, Y, Z)
plt.savefig('fonctions-surface-2e.png')
plt.tight_layout()
plt.show()