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...

 採用された回答

Matt Fig
Matt Fig 2011 年 6 月 11 日
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.

1 件のコメント

Hi Mat,
That is exactly what I was looking for. Thanks again! :-)

サインインしてコメントする。

その他の回答 (1 件)

bym
bym 2011 年 6 月 10 日
define your own color map. Do you want all of jet to be between 2 & 3 and the rest to be bone?

カテゴリ

ヘルプ センター および File ExchangeColor and Styling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by