mirror of
https://github.com/Findus23/collision-analyisis-and-interpolation.git
synced 2024-09-19 15:13:50 +02:00
try out plotting a 2d function
This commit is contained in:
parent
8a3197b814
commit
501f25468f
1 changed files with 25 additions and 0 deletions
25
sinus.py
Normal file
25
sinus.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
|
||||
def func(x, y):
|
||||
return (np.sin(y) + np.sin(x) + 1) / 3
|
||||
|
||||
|
||||
xs = np.linspace(-15, 15, 30)
|
||||
ys = np.linspace(-15, 15, 300)
|
||||
|
||||
res = []
|
||||
for y in ys:
|
||||
rererere = []
|
||||
for x in xs:
|
||||
rererere.append(func(x, y))
|
||||
res.append(rererere)
|
||||
|
||||
data = np.asarray(res)
|
||||
|
||||
# plt.contourf(xs, ys, data, 100, cmap="Blues", vmin=0, vmax=1)
|
||||
plt.pcolormesh(xs, ys, data, cmap="Blues", vmin=0, vmax=1)
|
||||
plt.colorbar()
|
||||
|
||||
plt.show()
|
Loading…
Reference in a new issue