plot two contours in the same figure with decoupled colorbar

조회 수: 6 (최근 30일)
Sei Him Cheong
Sei Him Cheong 2015년 9월 28일
댓글: Walter Roberson 2015년 9월 29일
does any know how do plot two sets of contour plot on a single figure, but have a decoupled colorbar?
basically, i have two datasets and
the first data set is in the format
[latitude longitude -depth]
the second data set is in
[latitude longitude +SPL level]
if i plot them together with 'hold on', the positive SPL values are all shown on the top end of colorbar and the negative value are shown on the bottom end of the colorbar, which means I only have red and blue and nothing in between.
so i would like to show the full color range of both dataset by decoupling the z-axis and display colorbar only for the second dataset.
I hope i made it clear enough
Thanks in advance!
Regards

답변 (1개)

Walter Roberson
Walter Roberson 2015년 9월 28일
Experiment with using caxis(), passing in the minimum and maximum values that you want to colorbar to cover. I am not certain that this will give you the overall color that you want, though.
  댓글 수: 2
Sei Him Cheong
Sei Him Cheong 2015년 9월 29일
Hi Walter, Thanks for the comment. I did use Caxis to alter the color range, but not getting any good result as the water depth data ranges from 10 to 5000 but the SPL data are only within 0-150. So I am not getting good color resolutions.
Walter Roberson
Walter Roberson 2015년 9월 29일
If you are using R2014b or later you can plot them in different axes (which might visually be on top of each other) and use a different colormap for each axes and parent the colorbar to the appropriate axes.
If that does not work or you are using a previous MATLAB then you will need to convert the first plot to RGB instead of pseudocolor, so that the colormap and colorbar can have meaning only for the other data. To do the conversion you can use http://www.mathworks.com/matlabcentral/fileexchange/7943-freezecolors---unfreezecolors

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

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by