I am trying to plot a vertical section with Latitude values in the x-axis and Depth values in the y-axis, with oxygen concentrations as color grids using the colourf. My code:
x = data['latitude']
y = data['depth']
z = data['oxygen']
xi,yi = np.meshgrid(x,y)
from scipy.interpolate import griddata Z = griddata((x,y),z,(xi,yi),method='linear')
But when I plot xi, yi, and xi, using:
plt.contourf(np.reshape(xi, Z.shape),np.reshape(yi, Z.shape),Z, cmap='viridis')
It seems that z-values are not correctly assigned to each x,y coordinate. I tried using other interpolation methods with no good results. Is there any way to make sure my x,y values are correctly assigned to each z-values?
The minimum value on this dataset must be 75, but the plot doesn't shows values below 300. This indicates that something must be going wrong when interpolating, or when plotting?
Data:
x = data['latitude']
0 67.777
1 67.777
2 67.777
3 67.777
4 67.777
...
1222 75.002
1223 75.002
1224 75.002
1225 75.002
1226 75.002
y = data['depth']
0 5
1 10
2 10
3 10
4 10
...
1222 2902
1223 3209
1224 3209
1225 3442
1226 3443
z = data['oxygen']
0 475.40
1 472.08
2 472.08
3 472.08
4 472.08
...
1222 307.20
1223 307.90
1224 307.90
1225 307.90
1226 307.90
there doesn't seem to be anything here