One figure with two graphics in different colormaps

55 views (last 30 days)
Hello: I want to create a figure where I can superimpose 2 graphics. The first one is a kind of scalar contour. The second one is a surf bathymetry with a different scale. I can draw the two sets well with the following command, but I can’t make the two different colormaps for each “figure” as I would like (I comment these “desired” ouputs). Thanks in advance.
hSlice=slice(X, Y, Z, S2, x1,[], []);
shading interp
hold on
hSurface = surf(X,Y,S1);
shading interp

Answers (2)

Daniel Shub
Daniel Shub on 31 May 2013
MATLAB figures can only have a single colormap. One option is to define your own color map which concatenates the two desired colormaps and then transform the zscale of your second surface to use the extended colormap. You would then have to define your own colorbar functions...

Image Analyst
Image Analyst on 31 May 2013
Try this:;jsessionid=a8108c3ea8d18c73bd38344fd59e I also have a demo that's a lot better at giving hands on code than that Mathworks solution, though the demo is for images rather than graphics. Let me know if you'd like to see it anyway - it might still be applicable.


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!