Hello,
I would like to have multiple image plots in a figure. Each plot should have its own colorbar. I tried the following:


···
**********************************
a = N.array(((1,2,3), (4,5,6)))
P.figure(0)
P.subplot(1,2,1)
P.imshow(a)
P.colorbar()
P.subplot(1,2,2)
P.imshow(a)
P.colorbar()
************************************
The two images display and have their own colorbar, each. However, the placement is not optimal. (see attached 'colorbar1.png') But when I try to use the "Configure subplot parameters" feature in the interactive figure window, only the image plots are affected and the colorbars stay as they are. When I hit the reset button in the "configure subplots" dialogue, the figure looks different from the way it looked, when it was generated (see attached 'colorbar2.png'). Do I have to do all the placement on my own by using axes.set_position or is there a more comfortable way using the subplot syntax?
Thanks
Lars
Lars,
I don't think you can do much about this using the interactive tool, so your options are:
1) position all axes explicitly, or
2) use colorbar kwargs to get a more pleasing arrangement. The relevant kwargs are:
fraction = 0.15; fraction of original axes to use for colorbar
pad = 0.05 if vertical, 0.15 if horizontal; fraction
of original axes between colorbar and
new image axes
shrink = 1.0; fraction by which to shrink the colorbar
aspect = 20; ratio of long to short dimensions
Eric
Lars Friedrich wrote:
···
Hello,
I would like to have multiple image plots in a figure. Each plot should have its own colorbar. I tried the following:
**********************************
a = N.array(((1,2,3), (4,5,6)))
P.figure(0)
P.subplot(1,2,1)
P.imshow(a)
P.colorbar()
P.subplot(1,2,2)
P.imshow(a)
P.colorbar()
************************************
The two images display and have their own colorbar, each. However, the placement is not optimal. (see attached 'colorbar1.png') But when I try to use the "Configure subplot parameters" feature in the interactive figure window, only the image plots are affected and the colorbars stay as they are. When I hit the reset button in the "configure subplots" dialogue, the figure looks different from the way it looked, when it was generated (see attached 'colorbar2.png'). Do I have to do all the placement on my own by using axes.set_position or is there a more comfortable way using the subplot syntax?
Thanks
Lars
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options