From: Benjamin R. <ben...@ou...> - 2010-08-29 18:04:02
|
On Sun, Aug 29, 2010 at 6:29 AM, xyz <mi...@op...> wrote: > On 29/08/10 17:28, Eric Firing wrote: > > On 08/28/2010 06:40 PM, xyz wrote: > >> Hello, > >> If I use autoscale_view than: > >> * plt.text appears outside x and y coordinates > >> * and the coordinates starts do not from 0 whereas I use ax.set_xlim(0) > >> and ax.set_ylim(0) > >> > >> What did I wrong? > > The call to autoscale_view overrides the earlier calls to set_xlim and > > set_ylim. There is no built-in mechanism for autoscaling only the upper > > limit, and holding the lower limit fixed. You could make such a > > mechanism by writing a custom Locator, but it may make more sense to > > calculate the upper limit directly in your code based on your data, and > > then use set_xlim and set_ylim to set both ends of each axis. > > > > Eric > > > > Thank you for your answer. However, I do not how to calculate the upper > limit directly from my code based on my data, and then use set_xlim and > set_ylim to set both ends of each axis. Could you show me please how to > do it? > > Thank you in advance. > > You could try: maxy = max(max(y1), max(y2)) maxx = max(x) ax.set_xlim((0.0, maxx)) ax.set_ylim((0.0, maxy)) I hope that helps, Ben Root |