Reputation: 259
I am using this code to visualise my data using griddata. The code looks like this:
import math
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
**THE LIST C=DATA IS IN THE LINK ABOVE**
cx=np.asarray([row[0] for row in C])
cy=np.asarray([row[1] for row in C])
cz=np.asarray([row[2] for row in C])
xi = np.linspace(22.4,22.5,10)
yi = np.linspace(37,37.1,10)
# grid the data.
zi = griddata((cx, cy), cz, (xi[None,:], yi[:,None]), method='nearest')
plt.contourf(xi,yi,zi,300,cmap=plt.cm.jet)
# draw colorbar
plt.colorbar()
plt.xlim(xmin=22.4,xmax=22.5)
plt.ylim(ymin=37,ymax=37.1)
plt.title('no diamonds please')
plt.show()
As you can see there are some diamond shaped shapes which in fact should have been like the contours of a gaussian like for example shown here
Am i doing something wrong? Should i use some other tool instead of griddata? I had problems using sagemath for this and now switched to ""pure" python. Noob level keep in mind :)
Upvotes: 2
Views: 645
Reputation: 259
Silly as it is, the answer is just to increase the value of "stepsize" in linspace like i.e:
xi = np.linspace(22.4,22.5,100)
Upvotes: 1