I have a function x = F(z,y). I want to map the x value to the color. How do I do this?
Partial code:
z = r * np.cos(theta)
y = r * np.sin(theta)
x = V(r, V_avg,R)
# Create a 3D plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# Plot the surface
surface = ax.plot_surface(x,y,z, cmap='viridis')
# Add a color bar which maps values to colors
fig.colorbar(surface, ax=ax, label='Paraboloid Function Value')
# Set labels
ax.set_xlabel('X-axis')
ax.set_ylabel('Y-axis')
ax.set_zlabel('Z-axis')
# Show the plot
plt.show()
Output:

You could map colors from your color map to x-values, creating an array of colors like in this example, and use those colors to plot the surface together with its color bar:
The result: