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개)
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
2017년 6월 22일
편집: Max Campbell
2017년 6월 22일
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에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!