plot two contours in the same figure with decoupled colorbar

2 Ansichten (letzte 30 Tage)
Sei Him Cheong
Sei Him Cheong am 28 Sep. 2015
Kommentiert: Walter Roberson am 29 Sep. 2015
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

Antworten (1)

Walter Roberson
Walter Roberson am 28 Sep. 2015
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 Kommentare
Sei Him Cheong
Sei Him Cheong am 29 Sep. 2015
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 am 29 Sep. 2015
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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Colormaps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by