I need to contour x, y , z data. Below is a minimal working example:
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
z = [20, 40, 60, 80, 100]
So, z = 20 is at the coordinate (1, 2), z = 40 is at the coordinate (2, 4) and so on. In reality, I have longitude and latitude coordinates with soil conductivity values at each point in space.
I would like to contour using plt.contour() or something similar to this. However, z has to be a 2d array. I am fairly fluent in python. But, I don't fully grasp how to create meshes.
Every example of contour example I have seen, z is calculated from a function of x and y.
This is my first question in the community, so please advise if my question needs to be more thorough.
Things I tried: enter image description here enter code here
This raises an error that z must be a 2d array.
When I try using:z = np.reshape(z, (-1, 2)
, then, x isn't the same shape. Other people have used meshing techniques as well?
How can I make z a 2d array for contouring? Should I reshape all of the data?