Two colormaps on one colorbar: one colormap covering all z data and the other covering a key region

Hi there,
If I have, for example, all my z data varying between 0 to 10 I would like to set the overall colormap (0 to 10) to bone, but a key region, say between2 to 3, set to jet. Finding this pretty hard to do... Thanks...

 Réponse acceptée

Here is an example:
% Start by making the colormap
CM = bone(1000);
CM(200:300,:) = jet(101);
colormap(CM) % Set the colormap of the figure
% Now we'll plot some data that goes from 0 to 10.
[X,Y,Z] = peaks(500);
mn = min(Z(:));
R = max(Z(:)) - mn;
Z = (Z + abs(mn))*10/R;
S = surf(X,Y,Z);
set(S,'edgecolor','none','facecolor','interp')
view(61,64)
rotate3d
% Look at view(90,0), the region between z = 2 and z = 3 is jet.

Plus de réponses (1)

define your own color map. Do you want all of jet to be between 2 & 3 and the rest to be bone?

Catégories

En savoir plus sur Color and Styling dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by