get parent or child from twinx() or twiny()

Hello everybody

This is my first post to the list.

To the point.

I want to access the all the axes located
where a mouse event occurred.

My first try is with button_release_event

The event will include inaxes, so I know the axes where the mouse event
occurred.

This is fine if at that location I have only one axes.

If I have a twinx or twiny I only get the axes with the biggest zorder.

The example:

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)

ax.plot(range(100),range(100))
ax1 = ax.twinx()

plt.show()

The question
Having either ax or ax1 is it possible to find the other?

In other words, from a given axes instance, is it possible to know which other axes

“share” the same xaxis or yaxis?

Thanks

Federico

···


Y yo que culpa tengo de que ellas se crean todo lo que yo les digo?

– Antonio Alducin –

Hello everybody

This is my first post to the list.

Welcome.

To the point.

I want to access the all the axes located
where a mouse event occurred.

My first try is with button_release_event

The event will include inaxes, so I know the axes where the mouse event
occurred.

This is fine if at that location I have only one axes.

If I have a twinx or twiny I only get the axes with the biggest zorder.

The example:

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)

ax.plot(range(100),range(100))

ax1 = ax.twinx()

plt.show()

You can get all the x-axes shares with “ax1” (not including ax1) with the following:

sharedx = [ax for ax in ax1.get_shared_x_axes().get_siblings(ax1) if ax is not ax1]

sharedx is a list of axes who share the x-axis with ax1

···

On Tue, Feb 28, 2012 at 12:45 PM, Federico Ariza <ariza.federico@…287…> wrote:

The question

Having either ax or ax1 is it possible to find the other?

In other words, from a given axes instance, is it possible to know which other axes

“share” the same xaxis or yaxis?