yaxis labels using subplot

Hi all,

Actually this is more like two problems :slight_smile:

I am trying to turn off the yaxis labels on the right hand side figure generated via subplot. After some trial and error it seems that I should be able to change these settings using the set command. For example you should be bale to do the following

plot([1,2,3,4], [1,4,9,16])
set(gca(), 'xticks', [1,2,3,4])

as per the ipython instructions. However I have a complaint about the number of arguements (see below). This has been tried in a variety of ways, apart from a way that actually works.

In [1]: plot([1,2,3,4], [1,4,9,16])
Out[1]: [<matplotlib.lines.Line2D instance at 0x8a490ac>]

In [2]: set(gca(), 'xticks', [1,2,3,4])

路路路

---------------------------------------------------------------------------
<type 'exceptions.TypeError'> Traceback (most recent call last)

/home/stephens/Fe_profiles/20yr_SS_BATS/<ipython console> in <module>()

<type 'exceptions.TypeError'>: set expected at most 1 arguments, got 3

So i)does anybody know of an easy (/sucessful) way of turning off the rhs yaxis labels and ii) does anybody know why I am apparently having issues with putting more than one argument in the set command when, according to the help instructions, it should be possible.

thanks in advance,

nick stephens

I believe that "set" function in matplotlib has been deprecated
(because "set" is now python builtin). Instead, you have to use
"setp".

Setting "xticks" (or "yticks") changes the tick locations. If you're
trying to turn off only the labels, you may use use

setp(gca().get_yticklabels(), visible=False)

IHTH,

-JJ

2008/9/17 Nicholas Stephens <Nicholas.Stephens@...2159...>:

路路路

Hi all,

Actually this is more like two problems :slight_smile:

I am trying to turn off the yaxis labels on the right hand side figure
generated via subplot. After some trial and error it seems that I should be
able to change these settings using the set command. For example you should
be bale to do the following

plot([1,2,3,4], [1,4,9,16])
set(gca(), 'xticks', [1,2,3,4])

as per the ipython instructions. However I have a complaint about the number
of arguements (see below). This has been tried in a variety of ways, apart
from a way that actually works.

In [1]: plot([1,2,3,4], [1,4,9,16])
Out[1]: [<matplotlib.lines.Line2D instance at 0x8a490ac>]

In [2]: set(gca(), 'xticks', [1,2,3,4])
---------------------------------------------------------------------------
<type 'exceptions.TypeError'> Traceback (most recent call last)

/home/stephens/Fe_profiles/20yr_SS_BATS/<ipython console> in <module>()

<type 'exceptions.TypeError'>: set expected at most 1 arguments, got 3

So i)does anybody know of an easy (/sucessful) way of turning off the rhs
yaxis labels and ii) does anybody know why I am apparently having issues
with putting more than one argument in the set command when, according to
the help instructions, it should be possible.

thanks in advance,

nick stephens

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users