Properly aligned tick labels on the inside

For the archives (and further proof that programming done during the
witching hour between 4pm and 5pm should be avoided at all costs):

The solution is easy.

for tick in axes.yaxis.get_major_ticks():


-----Original Message-----
From: Anthony M. Floyd
Sent: July 12, 2007 4:37 PM
Subject: [Matplotlib-users] Properly aligned tick labels on the inside

Hi All,

I'm trying to plot tick labels on the inside (ie data side)
of a typical x-y plot. My setup is Python 2.5.1, matplotlib
0.90.0 on WinXP.

I've been able to accomplish this by adjusting the padding of
the individual ticks, but it doesn't quite accomplish what I want.

For example, imagine a typical x-y plot, except that the tick
labels are on the right-hand side (by setting
axes.yaxis.tick_right()). Adjusting the padding of the ticks
by doing:

for tick in axes.yaxis.get_major_ticks():

I'm able to get the numbers to appear about where I want.
The problem is that these numbers are left aligned. So, it
works fine for small numbers, but for large numbers, or when
my tick formatter switches over to using scientific notation
the numbers will overlap the axis. If my labels are on the
inside of the right-hand side, I want them to be
right-aligned and grow left towards the centre of the plot.

I thought about doing it by setting tick_left() and then
using a (large) computed pad, but then the tick lines are on
the wrong side.

So, my question is: can I get right-aligned tick labels on
the right-side of a plot? How?

I suspect I can do this by using
axis.set_offset_position('...'), but I've been unable to get
that to do anything in my tests using pylab.

I can post code if it'll be helpful.


Anthony Floyd, PhD
Convergent Manufacturing Technologies Inc.
6190 Agronomy Rd, Suite 403
Vancouver BC V6T 1Z3

Email: Anthony.Floyd@...1616... | Tel: 604-822-9682
WWW: | Fax: 604-822-9659

CMT is hiring: See for details

This email is sponsored by DB2 Express Download DB2
Express C - the FREE version of DB2 express and take control
of your XML. No limits. Just data. Click to get it now.
Matplotlib-users mailing list