# 3D surface parametric plot: bind colormap to something other than z

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’?

Best

Giovanni

Did you solve this? I am trying to achieve the same.

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.

1 Like

You can achieve this using the `surfacecolor` attribute.

See example: https://plot.ly/python/3d-surface-coloring/

I’ve read that before, but I still don’t understand how to change my plot. I don’t see what needs to change to change the axis plotting.

My current code for example:

``````data = [go.Surface(z=surfaceMatrix)]

layout = go.Layout(
title=args.i,
autosize=True,
width=1590,
height=1000,

scene=dict(
aspectratio=dict(x=3, y=1, z=1),
aspectmode = 'manual',
yaxis=dict(
title='Size',
titlefont=dict(
family='Arial, sans-serif',
size=18,
#color='lightgrey'
),
type='log',
autorange=True,
),
xaxis=dict(
title=" Co-ordinates",
titlefont=dict(
family='Arial, sans-serif',
size=31,
#color='lightgrey'
),
#autorange=False,
ticks='inside',
showgrid=True,
ticktext=["-" + str(args.e),str(boundD['rangeStart'] + args.e), str(boundD['rangeEnd'] - args.e), "+" + str(args.e)],
tickvals=[0, upstream, (100 - upstream), 100]
),
),

)
#shapes = buildGeneModel()

fig = go.Figure(data=data, layout=layout)
outname = str(args.i) + "-3Dsurface.html"
plotly.offline.plot(fig, filename=outname)```````

No need to change the axis properties.

The required change in the `surface` trace you’re trying to plot.