how to make an axis labels visible in axes_grid?

Hi,

I have an AxesGrid instance of 2x2 subplots. I actually only
want 3 subplots, so I instantiate AxesGrid with the add_all=False
option, and manually add only the first 3 axes to the figure:

import matplotlib as plt
from mpl_toolkits import axes_grid

f = plt.figure()
grid = axes_grid.AxesGrid(f, 111, nrows_ncols=(2,2), add_all=False)
f.add_axes(grid.axes_all[0])
f.add_axes(grid.axes_all[1])
f.add_axes(grid.axes_all[2])

Now, the problem seems to be that the top right subplot doesn't
have visible labels on the x axis, and I can't figure out how to
add them. Any idea of how it can be done??

Thanks.

Ernest

axes_grid uses a custome axes class. See

http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline

For more details, see

http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/axislines.html

To make ticklabel visible, you may do

grid.axes_all[1].axis["bottom"].major_ticklabels.set_visible(True)

However, AxesGrid takes an *ngrids* parameter which controls the
number of grids. So, in your example,

f = plt.figure()
grid = axes_grid.AxesGrid(f, 111, nrows_ncols=(2,2), ngrids=3)

(no manual adding of grids. also top-right axes will have x-ticklabels
by default).

Regards,

-JJ

···

On Mon, Feb 8, 2010 at 7:09 AM, Ernest Adrogué <eadrogue@...361...> wrote:

Hi,

I have an AxesGrid instance of 2x2 subplots. I actually only
want 3 subplots, so I instantiate AxesGrid with the add_all=False
option, and manually add only the first 3 axes to the figure:

import matplotlib as plt
from mpl_toolkits import axes_grid

f = plt.figure()
grid = axes_grid.AxesGrid(f, 111, nrows_ncols=(2,2), add_all=False)
f.add_axes(grid.axes_all[0])
f.add_axes(grid.axes_all[1])
f.add_axes(grid.axes_all[2])

Now, the problem seems to be that the top right subplot doesn't
have visible labels on the x axis, and I can't figure out how to
add them. Any idea of how it can be done??

Thanks.

Ernest

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users