I have 2 1D arrays with x and y values, as well as a 2D array with z values ββfor each point where the columns correspond to x values ββand the rows correspond to y values. Is there any way to get plot_surface with this data? when I try to do this, he does not return me any conspiracy. Here is the code: (calculate_R is the function I made for the program)
x=np.arange(0,10,1)
y=np.arange(0,1,0.2)
lx= len(x)
ly=len(y)
z=np.zeros((lx,ly))
for i in range(lx):
for j in range(ly):
z[i,j]=calculate_R(y[j],x[i])
fig = plt.figure()
ax = Axes3D(fig)
x, y = np.meshgrid(x, y)
ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap='hot')
source
share