1
0
Fork 0
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:
Lukas Winkler 2019-02-13 12:53:29 +01:00
parent 8a3197b814
commit 501f25468f

25
sinus.py Normal file
View 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()