How to use two seperate colorbars on the same plot.

Hello,
I am trying to make topographic map, using data from above and below the sea surface. I want to use two different colormaps, one for above the sea surface(positive z values) and one for below the sea surface(negative z values). Any help would be greatly appreciated.
Max

답변 (1개)

Adam
Adam 2017년 6월 22일
편집: Adam 2017년 6월 22일
You don't need two different colourmaps for that - you can join together two colourmaps yourself into a single one e.g.
cmap = [ summer(256); hot(256) ];
figure; imagesc( rand(100) - 0.5 );
colormap( gca, cmap );
You can do the same obviously with custom colourmaps or just create your own colourmap in any way you want.
You just need to ensure that you keep a symmetric colour range e.g.
clims = [-1 1] * max( abs( myData(:) ) );
caxis( hAxes, clims );
for some data, myData, and for an axes handle hAxes

댓글 수: 2

Max Campbell
Max Campbell 2017년 6월 22일
편집: Max Campbell 2017년 6월 22일
Ok thanks.
The data range is from 100 to -5000. is it possible to make one colour map represent data above 0 and the other represent data below zero? I.e. to show a clear difference between land and sea. otherwise the transition is 2500m below the surface.
thanks
Adam
Adam 2017년 6월 22일
You can play around with where you concatenate colourmaps if you wish, but it does get complicated - e.g. you can concatenate a colourmap of size 32 with a colourmap of size 128 to achieve an assymetric total colourmap, but you would have to work out the maths for what size you would need for each portion of the colourmap in that case.
in your case I guess you need the negative part of the colourmap to be 50 times bigger than the positive part if you fix the clims to [-5000 100]

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Orange에 대해 자세히 알아보기

질문:

2017년 6월 22일

댓글:

2017년 6월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by