When performing a 3D parametric plot with plotly, the surface coloring is always bound to the ‘z’ coordinates. This is often not desirable. A classical example are antenna radiation plots, where the coloring is a function of the radial coordinate r=sqrt(x^2+y^2+z^2). Is it possible to perform a surface plot with plotly binding the colormap to another scalar vector other than the coordinate ‘z’?

I’d like to be able to change color of the surface plot to something other than Z coordinate also, but could not figure out a way to do so. The work around I’ve been using is to use a 3D scatter plot instead, where I’ve made a fairly dense field of points that get plotted in 3D, and can be set to whatever color scheme you’d like. Its not a surface, but if the points are dense enough it looks like a surface.