plot two contours in the same figure with decoupled colorbar
2 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Walter Roberson
on 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 Comments
Walter Roberson
on 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
See Also
Categories
Find more on Colormaps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!