And forwarded to the list… forgot to hit reply to all.
···
---------- Forwarded message ----------
From: Angus McMorland <amcmorl@…287…>
Date: 2008/10/13
Subject: Re: [Matplotlib-users] how do I get my axis
To: Mathew Yeates <myeates@…369…>
2008/10/13 Mathew Yeates <myeates@…369…>
Thanks Angus. I tried this out … it works once and only once!
BTW, The correct thing to do is
res=fig.gca()
res.fmt_xdata=foo() #instead of format_xdata
res.fmt_ydata=foo()
I’ve just dug around in some old code, now that you’ve shown me this example to jog my memory. Perhaps you want to try res.fmt_xdata=foo (i.e. no brackets, so you pass the function, not the result of the function).
Angus.
although, like I said, it only first for the first event. Somehow res.fmt_xdata is getting set back to None
Mathew
Angus McMorland wrote:
Hi Mathew,
2008/10/13 Mathew Yeates <myeates@…369… mailto:myeates@...369...>
Okay, I've gotten this far. I have a Figure and I think I can change the formatting of the values displayed in the toolbar by setting taking the X axis and setting the function format_xdata to something of my own (something that computes lat/lon). Similar idea for the Y axis. So, given my figure, how do I get the X and Y axis? All I see is gca(). But how can I get both? Using fig.get_axes() I only got 1 axis.
I think this is a terminology issue: the axis objects returned by gca() or in the list returned by get_axes() incorporate both the ‘axes’ in the sense of x and y axes. With the single result of gca() you can get at both the x and y axes. For example:
import matplotlib.pyplot as plt
ax = plt.gca()
ax.set_xlims(xmin=-1)
ax.set_ylims(ymax=0)
ax.format_xdata = … # if this is how you use this bit - haven’t needed to change these myself
ax.format_ydata = …
I hope that helps,
Angus.
–
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
–
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
–
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh