This is my first time trying out this list, so please forgive me if I've doing this wrong.
I'm trying to create a plot that has its origin in the upper-left hand corner, rather than the lower-left hand corner. I've discovered that I get the same effect if I do:
On Mon, Mar 29, 2010 at 10:20 PM, <Rachel-Mikel_ArceJaeger@…3047…> wrote:
Hello,
This is my first time trying out this list, so please forgive me if I’ve doing this wrong.
I’m trying to create a plot that has its origin in the upper-left hand corner, rather than the lower-left hand corner. I’ve discovered that I get the same effect if I do:
plt.plot( xcoords, ycoords, ‘ro’ )
plt.axis( [0, maxX, maxY, 0] )
However, the x-axis still appears on the bottom of the graph rather than the top.
Is there a way that I can shift the location of the origin more easily, or at least shift where the axis is written at?
This is my first time trying out this list, so please forgive me if I've doing this wrong.
I'm trying to create a plot that has its origin in the upper-left hand corner, rather than the lower-left hand corner. I've discovered that I get the same effect if I do:
The only problem I have is that show() never terminates? If I force terminate it and close the figure, then all I ever have to do is call draw() and the figure reappears, but I have to call show() at least once, or else the figure will never appear. I don't want my program to create a figure until I absolutely have to, but I want to avoid non-termination and force-termination as well. Is there a way to do that?
~Rachel
···
----- Original Message -----
From: "Ryan May" <rmay31@...287...>
To: "Gökhan Sever" <gokhansever@...287...>
Cc: "Rachel-Mikel_ArceJaeger" <Rachel-Mikel_ArceJaeger@...3047...>, "matplotlib-users" <matplotlib-users@lists.sourceforge.net>
Sent: Tuesday, March 30, 2010 1:17:34 PM GMT -08:00 US/Canada Pacific
Subject: Re: [Matplotlib-users] Shifting the Origin
On Tue, Mar 30, 2010 at 2:10 PM, Gökhan Sever <gokhansever@...287...> wrote:
On Tue, Mar 30, 2010 at 2:37 PM, Ryan May <rmay31@...287...> wrote:
You're looking for the set_ticks_position method on the xaxis (I've
also tweaked setting the limits):
plt.plot(xcoords, ycoords, 'ro')
plt.xlim(0, maxX)
plt.ylim(maxY, 0)
ax = plt.gca() # Get current axes object
ax.xaxis.set_ticks_position('top')
plt.show()
This is easier
Could you get this one working ?
ax.xaxis.set_ticks_position('both')
It doesn't have an effect here on Qt4Agg using svn copy of matplotlib.
According to the docstring, it only puts ticks in both locations, not
labels, which is what I'm seeing here on SVN with the PyGTK backend.
Are you seeing something different?
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
You really should only call show() once (because it starts the event
loops for the user interface), usually at the end of your script,
which will bring up all of the figures. The script will then exit
when you close all of the figures.
If you're doing interactive work, you probably want to look into
something like ipython (http://ipython.scipy.org/moin/) which makes
working with plots interactively a breeze.
Ryan
···
On Tue, Mar 30, 2010 at 3:51 PM, Rachel-Mikel Arce Jaeger <Rachel-Mikel_ArceJaeger@...3047...> wrote:
Ryan's code works great - thanks!
The only problem I have is that show() never terminates? If I force terminate it and close the figure, then all I ever have to do is call draw() and the figure reappears, but I have to call show() at least once, or else the figure will never appear. I don't want my program to create a figure until I absolutely have to, but I want to avoid non-termination and force-termination as well. Is there a way to do that?
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
ax.xaxis.set_ticks_position(‘top’)
puts labels as well but ‘both’ works only for ticks. It would be nice in some instances to have tick-labels appear on bottom and top with this easy way one-line way.
···
On Tue, Mar 30, 2010 at 3:17 PM, Ryan May <rmay31@…1896…> wrote:
According to the docstring, it only puts ticks in both locations, not
labels, which is what I’m seeing here on SVN with the PyGTK backend.