Effacer les filtres
Effacer les filtres

colorbar position on imageplot with multiple figures

2 vues (au cours des 30 derniers jours)
Shane le 17 Avr 2013
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?

Réponses (1)

Adam Filion
Adam Filion le 17 Avr 2013
Modifié(e) : Adam Filion le 17 Avr 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.

Community Treasure Hunt

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

Start Hunting!

Translated by