changing sharex after ?

Hi all,

is there a possibility to change the sharex and sharey after creating a
axes ?

For example this perfectitly work :

import pylab

fig = pylab.figure()

ax1 = fig.add_subplot(121)

ax2 = fig.add_subplot(122, sharex=ax1)

ax1.plot(rand(5))

ax2.plot(rand(5))

pylab.show()

But when I try naively to change _sharex and _masterx after creating
the axes it doesn’t work :

import pylab

fig = pylab.figure()

ax1 = fig.add_subplot(121)

ax2 = fig.add_subplot(122)

ax1.plot(rand(5))

ax2.plot(rand(5))

ax2._sharex = ax1

ax1._masterx = True

pylab.show()

What 's the solution ?

thank you

Samuel

Samuel,

Trying to manipulate variables with leading underscores is discouraged--that is the meaning of the leading underscores.

Changing the shared status of axes involves changes in additional variables. This could be encapsulated in a single method. It might be very easy, or complexities and gotchas might turn up. How important is it? What is the problem with setting the shared status when you make the axes, as in your first example?

Eric

Samuel GARCIA wrote:

···

Hi all,
is there a possibility to change the sharex and sharey after creating a axes ?

For example this perfectitly work :

import pylab
fig = pylab.figure()
ax1 = fig.add_subplot(121)
ax2 = fig.add_subplot(122, sharex=ax1)
ax1.plot(rand(5))
ax2.plot(rand(5))
pylab.show()

But when I try naively to change _sharex and _masterx after creating the axes it doesn't work :

import pylab
fig = pylab.figure()
ax1 = fig.add_subplot(121)
ax2 = fig.add_subplot(122)
ax1.plot(rand(5))
ax2.plot(rand(5))
ax2._sharex = ax1
ax1._masterx = True
pylab.show()

What 's the solution ?
thank you

Samuel

------------------------------------------------------------------------

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hello,

I am writing a little GUI with PyQT4 and matplotlib.

So it is embeded.

I want that feature for the user : he can decided after ploting some
data to synchronize 2 graph with the x axis for the zoom.

So this method would be very useful for me. Maybe I can write it.

Do you have a idea of all the variables involved in the sharex feature ?

Thank you

Samuel

Eric Firing wrote:

···

http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-usershttp://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users