On Sun, Aug 8, 2010 at 10:38 PM, Simon Friedberger
<simon+matplot...@a-oben.org> wrote:
> a) I tried using the twinx() command like in that example but the axes
> seem to be scaled differently i.e. the ticks on the right don't have the
> same spacing as on the left.
>

twinx() creates an axes whose y-axis is independent from the original axes.

> b) Is it necessary to do that with twinx() or is there a way to set the
> labels for both sides independently?
>

Within a same axes, you cannot change the ticklabels of one side
without affecting the other side. This is also true between two axes
with shared axis.

One option would be to sync the limits of two axis manually (or
automatically using event). Another option you may consider is to use
the axes_grid1 toolkit (assuming that you're using mpl v1.0).



    from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost

    fig = plt.figure()
    ax = SubplotHost(fig, 111)
    fig.add_subplot(ax)

    ax2 = ax.twin() # "twin", not "twinx"
    ax2.axis["top"].toggle(ticklabels=False) # make ticklabels at top invisible

    ax2.set_yticks([0.,0.5, 1.])
    ax2.set_yticklabels(["A", "B", "C"])

-JJ

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to