Re: [Matplotlib-users] Using callbacks to change Axes positions

2010-03-05 Thread Jae-Joon Lee
divider.get_horizontal() returns a list of size objects (http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/api/axes_size_api.html#module-mpl_toolkits.axes_grid.axes_size) that are currently used. For example, cax = divider.new_horizontal(size="5%", pad=0.05) horiz_list = divider.get_ho

Re: [Matplotlib-users] Using callbacks to change Axes positions

2010-03-05 Thread Thomas Robitaille
Hi Jae-Joon, Thanks for your help! One last question - if I create a colorbar axes with cax = divider.new_horizontal(size="5%", pad=0.05) Is it possible to then modify the size and pad parameters, or do I need to delete the axes and start again? Cheers, Tom On Mar 5, 2010, at 12:20 PM, Jae-J

Re: [Matplotlib-users] Using callbacks to change Axes positions

2010-03-05 Thread Jae-Joon Lee
Unfortunately, axes_grid toolkit (in most cases) creates an axes using its own Axes class by default. Here is some more details. http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline To use mpl's original Axes class, append axes_class parameter. import matplotlib.

Re: [Matplotlib-users] Using callbacks to change Axes positions

2010-03-05 Thread Jae-Joon Lee
Hi, It turns out to be a bug (new_vertical works, but new_horizontal does not). To work around this right after cax = divider.new_horizontal(size="5%", pad=0.05, pack_start=True) add these lines locator = divider.new_locator(nx=0, ny=0) cax.set_axes_locator(locator) These two lines only need

Re: [Matplotlib-users] Using callbacks to change Axes positions

2010-03-05 Thread Thomas Robitaille
Hi Jae-Joon, I am encountering another issue, when using the method you suggest in combination with the parasite_axes from the matplotlib toolkit: --- import matplotlib.pyplot as mpl import numpy as np from mpl_toolkits.axes_grid import make_axes_locatable import mpl_toolkits.axes_grid.parasite

Re: [Matplotlib-users] Using callbacks to change Axes positions

2010-03-05 Thread Thomas Robitaille
Hi Jae-Joon, Thanks! This is exactly what I needed. Putting the colorbar on the right or bottom works great - however, I am running into issues with trying to put the colorbar on the left or bottom (which, from my understanding, is controlled by using pack_start=True?). Should the following cod

Re: [Matplotlib-users] Using callbacks to change Axes positions

2010-03-04 Thread Jae-Joon Lee
see http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg15919.html axes_grid toolkit provides some helper function that utilizes axes_locator (take a look at demo_locatable_axes_easy function in the example below) http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_

[Matplotlib-users] Using callbacks to change Axes positions

2010-03-04 Thread Thomas Robitaille
Hi, I am trying to set up a colorbar that automatically resizes if I zoom in to an image (which changes the aspect ratio of the axes, so I want the colorbar to get resized too). Let's say I have two Axes instances, say ax (for the main image) and cax (for the colorbar). I can set up a callback