I have a set of data to which I have done a least square fit. When I try to plot in order to eyeball the result I can’t get it to plot the proper ranges.
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(a_data, s_data, z_data, color='blue', marker='.')
A_range = np.linspace(minA, maxA, maxA-minA+1)
S_range = np.linspace(minS, maxS, maxS-minS+1)
A, S = np.meshgrid(A_range, S_range)
Z = polynom4deg((A, S), *popt)
ax.plot_surface(A, S, Z, color='red', alpha=0.5)
ax.set_xlabel('Assay')
ax.set_ylabel('Sample')
ax.set_zlabel('Z')
plt.show()
When I print a_data, s_data etc they seem correct. But the scatter plot always start at origin no matter what I set minA maxA, minS and maxS to. I don’t fully understand the linspace() and meshgrid(). Please point out what I’m missing.