First of all, unless you're displaying multiple images (with aspect),
there is not much of benefit  of using axes_grid toolkit. So I
strongly recommend you to stick to subplot.


axes_grid toolkit uses different kind of artists to draw ticklabels.
Therefore, most of the matplotlib command that try to change the
properties of the ticklabels does not work.

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

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

You may recover the original matplotlib behavior, but some of the
feature in axes_grid toolkit won't work.

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

axes_grid way of rotating ticklabels is

   ax.axis["bottom"].major_ticklabels.set_rotation(90)

But, you may want to fiddle with other properties also.

   ax.axis["bottom"].major_ticklabels.set_va("top")
   ax.axis["bottom"].major_tick_pad = -8

Anyhow, I must admit that handling of ticklabels in axes_grid toolkit
is a bit messy currently. And I hope to improve it soon.

Regards,

-JJ


On Fri, Dec 4, 2009 at 12:56 PM,  <phob...@geosyntec.com> wrote:
> Hey folks,
>
> I'm trying to make some bar plots using AxesGrid and the set_xlabels method 
> doesn't seem to notice that I'm passing a 'rotation' kwarg.
>
> Here's a small script that showing that this doesn't work:
> # ------------------------------------------
> import matplotlib.pyplot as pl
> from mpl_toolkits.axes_grid import AxesGrid
>
> fig = pl.figure()
> grid = AxesGrid(fig, 111, nrows_ncols=(1,1), axes_pad=0.12)
> xlabs = ['paul', 'chris', 'patti']
>
> for ax in grid:
>    ax.plot([1,2,3], [2,2.5,3], 'bo')
>    ax.set_ylim([0,5])
>    ax.set_xlim([0,4])
>    ax.set_xticks([1,2,3])
>    ax.set_xticklabels(xlabs, rotation=90)
> # -----------------------------------------
>
> As you can see from the attached image, my labels aren't rotating. This is 
> obviously a trivial example, but I'm trying to plot some chemical 
> concentrations and the names are quite long.
>
> Any tips? Should I just be using subpolot instead?
>
> Python 2.6.2 and:
> In [25]: import matplotlib as mpl
> In [26]: mpl.__version__
> Out[26]: '0.99.1'
> In [27]: import numpy as np
> In [28]: np.__version__
> Out[28]: '1.3.0'
>
> Thanks!
>
> Paul M. Hobson
> Senior Staff Engineer
> --
> Geosyntec Consultants
> 55 SW Yamhill St, Ste 200
> Portland, OR 97204
> Phone: (503) 222-9518
> www.geosyntec.com
>
>
>
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing.
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to