Problems with yticklabels in combination with the mpl toolkits

Hi everyone,

I try to make a simple subplot with yticklabels on the left and
right side. Everthing is allright, if I use the subplot command,
but I need the Subplot command from the mpl toolkits in order to hide
some axis. The code below doesn't work for me. Setting label2On=True
or False has no effekt.

Any hint?

Regards, Niko

...
...
from mpl_toolkits.axes_grid.axislines import Subplot

fig = plt.figure()
ax = Subplot(fig, 311)
fig.add_subplot(ax)

for tick in ax.yaxis.get_major_ticks():
    tick.label1On = True
    tick.label2On = True
    tick.label2.set_color('r')

...

···

--
View this message in context: http://www.nabble.com/Problems-with-yticklabels-in-combination-with-the-mpl-toolkits-tp25857213p25857213.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

If what you want is just to hide some axis, I (as a developer of
axes_grid toolkit) strongly recommend you to stick with the mainline
matplotlib. You can easily do it with spines.

http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html

axes_grid toolkit uses different kind of artist to draw ticks and
ticklabels, therefore it is not fully compatible with the mainlin
matplotlib. Please take a look at the axes_grid documentation.

http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/axislines.html

Instead of yaxis.get_major_ticks() and setting their attribute, you need to use

ax.axis["right"].major_ticklabels.set_visible(True)
ax.axis["right"].major_ticklabels.set_color("red")

or

ax.axis["right"].major_ticklabels.set(visible=True, color="red")

Regards,

-JJ

···

On Mon, Oct 12, 2009 at 10:58 AM, reyungoo <reyungoo@...2825...> wrote:

Hi everyone,

I try to make a simple subplot with yticklabels on the left and
right side. Everthing is allright, if I use the subplot command,
but I need the Subplot command from the mpl toolkits in order to hide
some axis. The code below doesn't work for me. Setting label2On=True
or False has no effekt.

Any hint?

Regards, Niko

...
...
from mpl_toolkits.axes_grid.axislines import Subplot

fig = plt.figure()
ax = Subplot(fig, 311)
fig.add_subplot(ax)

for tick in ax.yaxis.get_major_ticks():
tick.label1On = True
tick.label2On = True
tick.label2.set_color('r')

...
--
View this message in context: http://www.nabble.com/Problems-with-yticklabels-in-combination-with-the-mpl-toolkits-tp25857213p25857213.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options