MATLAB: How to combine multiple surf plots in one plot with different colormap

3d plotscolormapsurface

I want to combine three different surf plots, each one with a different colormap, into one plot. I am trying to do something similar to the surf and scatter3 example in the attached figure, but, with surfaces. I am using linkaxes but I am getting a warning: linkaxes requires 2-D axes as input. Use linkprop for generic property linking.
I tried to use linkprop but I couldn't combine the surf plots. I also used hold on and I was able to combine the surfaces but I couldn't have different colormaps. Which command can I use?

Best Answer

  • In R2014b or later, perhaps the easiest way to do what you want is to create multiple axes in the same location, setting all but one of the axes to 'off' so that it does not draw any axes box or tick marks, and setting the axes background colors to 'none' for all but the bottom one.
    The alternative is to create each plot one by one, and to use freezeColors from the File Exchange to turn them from pseudocolor into RGB, so that each becomes independent of following changes in the color map.
    I would suggest to you that using different colormaps for different objects in the same scene is likely to be confusing for people. People are going to tend to expect that the meaning of any one color is consistent between the different objects.