I am doing a project where I have x_mean, y_mean, z_mean from sensor readings. I have been given task to use the mean values as the z-axis of the plot. In the contour plot, I need the z-axis values of the plot to represent mean value at the X and Y coordinate. So basically I will have 3 different plots.
All I have is x_mean, y_mean, z_mean. So how can I make a contour plot for each of them?
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize=(6,5))
left, bottom, width, height = 0.1, 0.1, 0.8, 0.8
ax = fig.add_axes([left, bottom, width, height])
start, stop = 0, 5
x_vals = np.linspace(start, stop)
y_vals = np.linspace(start, stop)
X, Y = np.meshgrid(x_vals, y_vals)
print(X)
print(X.shape)
x_mean = -19.44287213
Z = x_mean
print(Z)
print(Z.shape)
cp = plt.contourf(X, Y, Z, 80)
plt.colorbar(cp)
ax.set_title('Contour Plot')
ax.set_xlabel('x')
ax.set_ylabel('y')
plt.show()