How can I put a custom colorbar into a figure with multiple datasets/datatypes
1 次查看(过去 30 天)
显示 更早的评论
I have an interesting situation where I am trying to overlay 3 different datatypes and make a custom colorbar for one of them.
For context, it first has and RBG image loaded using imagesc, scaled to lat/lon limits. The colors of the image are supposed to correlate with concentration and this is what I which to display in the color bar (the dark green to bright yellow).
Secondly, it has two contours (contourf): one for the depth contours and one for the coastline. This is overlayed so that it lines up with the RGB image. These contours also have their own colormap
Finally, it has 3 sets of data plotted using just 'plot' overtop of that.
I have created a custom color set corresponding to the range of colors in the RGB image, but I need the land and everything else to follow a different colormap. I also need to somehow scale the colorbar output to the corresponding concentrations. Currently, the colorbar only uses the depth data, and changing the colormap changes the colormap of all data sets. I hope the images below make the issue more clear.
I would like the colorbar to have the colors of the first picture, but scaled to the concentrations and not depth. And I would like the rest of the image to look like the second picture.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1714201/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1714206/image.png)
Thank you in advance! And sorry if this isn't super clear.
Sean
4 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!