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

16 views (last 30 days)
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?

Accepted Answer

Walter Roberson
Walter Roberson on 26 Jun 2017
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.
  1 Comment
urvashi bothra
urvashi bothra on 3 Sep 2021
Hi Walter,
I have the similar question. I have generated different surface plot in matlab using surf command and now, I want to represent in a single image but with different colours. Using hold on option leads to 1 colourmap and thus, I cannot distinguish the different surfaces.
Can you please elaborate your answer.
Many thanks,
Urvashi

Sign in to comment.

More Answers (0)

Categories

Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!