colorbar position on imageplot with multiple figures
1 view (last 30 days)
Show older comments
I have an image plot with two figure on it. When I add the color bar, with whatever location parameters I used, it uses those location parameters relative to the last image in the image plot.
Can I make the colorbar more global, i.e., below both images in my imageplot?
Adam Filion on 17 Apr 2013
Edited: Adam Filion on 17 Apr 2013
Colorbars are associated with a particular axis. If you do not specify which axis, then it will be added to the last one you used. See the documentation on colorbar for info on how to use a handle to the axis to specify which axis to add it to using the peer property of the colorbar:
>> doc colorbar
I don't know of an easy way to place a colorbar in an arbitrary location, such as spanning the width of a figure with two subplots above it. The best solution I know of offhand is to use the GUI Layout Toolbox from the File Exchange to construct this:
It's a very powerful set of tools with great documentation to go with it. If anyone has a simpler solution (another FEX submission maybe?) I'd love to hear it.
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!