-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultivariable_matplotlib3d.py
65 lines (51 loc) · 1.34 KB
/
multivariable_matplotlib3d.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- coding: utf-8 -*-
"""multivariable_Matplotlib3D.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1woqTvM1E4wk4z5n-Z_ia4fKr2bgBEjYN
"""
import numpy as np
import matplotlib.pyplot as plt
f = lambda x, y: x**4+y**4
x = np.linspace(-2,2,100)
y = np.linspace(-2,2,100)
X, Y = np.meshgrid(x,y)
F = f(X,Y)
plt.contour(X,Y,F,200
)
plt.show()
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
f = lambda x, y: x**4+y**4
x = np.linspace(-2,2,50)
y = np.linspace(-2,2,50)
X, Y = np.meshgrid(x,y)
F = f(X,Y)
fig = plt.figure(figsize = (12,8))
ax = fig.gca(projection = '3d')
ax.plot_surface(X, Y, F, cmap=cm.coolwarm)
plt.show()
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
f = lambda x, y: x**4+y**4
x = np.linspace(-2,2,50)
y = np.linspace(-2,2,50)
X, Y = np.meshgrid(x,y)
F = f(X,Y)
def plotter(E,A):
fig = plt.figure(figsize = (12,8))
ax = fig.gca(projection = '3d')
ax.plot_surface(X, Y, F, cmap=cm.coolwarm)
ax.view_init(elev=E,azim=A)
plt.show()
plotter(30,15)
from ipywidgets import interactive
iplot = interactive(plotter,
E = (-90,90,5),
A = (-90,90,5)
)
iplot