James Boyle <boyle5@...99...> writes:
I have not been able to figure out how to just make the first and
last ytick labels vanish. [...]
I thought that the following might work but this just makes all the
labels disappear - my understanding is incomplete.
ytl = a.get_yticklabels()
ytl[0]._visible = False
ytl[-1]._text = False
It is usually a bad idea to manipulate directly anything starting with
an underscore -- that's a Pythonic way of indicating a "private"
variable. The set_visible() method should work here:
ytl = a.get_yticklabels()
ytl[0].set_visible(False)
···
--
Jouni K. Sepp�nen
I think I was the one who asked a similar question a while back. Here
is a link to John's response:
http://article.gmane.org/gmane.comp.python.matplotlib.general/5465
I followed his advice and created my own formatter:
from matplotlib.ticker import LogFormatterMathtext
class MyFormatter(LogFormatterMathtext):
def __call__(self, x, pos=None):
if pos==0: return '' # pos=0 is the first tick
else: return LogFormatterMathtext.__call__(self, x, pos)
ax.xaxis.set_major_formatter(MyFormatter())
···
On 9/14/07, Jouni K. Seppänen <jks@...397...> wrote:
James Boyle <boyle5@...99...> writes:
> I have not been able to figure out how to just make the first and
> last ytick labels vanish. [...]
> I thought that the following might work but this just makes all the
> labels disappear - my understanding is incomplete.
> ytl = a.get_yticklabels()
> ytl[0]._visible = False
> ytl[-1]._text = False
It is usually a bad idea to manipulate directly anything starting with
an underscore -- that's a Pythonic way of indicating a "private"
variable. The set_visible() method should work here:
ytl = a.get_yticklabels()
ytl[0].set_visible(False)
--
Jouni K. Seppänen
http://www.iki.fi/jks
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options