MATLAB: Surface with 4th argument for color

surface color plot surf contour molecular dynamics fourth argument variable

Hi, I was wondering if someone could tell me if there is a way to add custom coloring to a surface based on a 4th variable. I work in in molecular dynamics and I have modeled a molecular surface based on X, Y, Z coordinates. Now, I'd like to color the surface based on a charge variable.
Can this be done?

Best Answer

Sure, use the fourth argument as an index into your colormap's colors, much like I did here: