# matlab-like "children" of axes?

Hello all

My specific question is this:

Suppose I have a figure, with an axes object, and an XY plot:

···

#-------
import matplotlib
import pylab as P

t = P.arange(0.0,1.0,0.02)
x = P.sin(2*P.pi*t)
y = P.exp(-t*3.)*P.cos(3*P.pi*t)

ff = P.Figure(figsize=(5,4), dpi=100)
ss = P.subplot(222)
pp = ss.plot(x,y,'.-')

# some program resets x,y limits
P.show()
#-----

(Sorry for my matlab-tainted language):

I would like to use ff.gca() to get the handle of the
active axes object (which should be ss) and then
determine the indices into the original data (x,y)
which reflect the points showing in the current
axis limits (whatever they have been set to)

Is there any way to
- find the axes objects that count "ff" as their parent?
- access the x,y points as "children" of the axes object ss?

I may be approaching my larger goal the wrong way,
but I am still interested in this question.

Thanks,
Jules

Jules,

ff = P.Figure(figsize=(5,4), dpi=100)
ss = P.subplot(222)
pp = ss.plot(x,y,'.-')

# some program resets x,y limits
P.show()
#-----

Is there any way to
- find the axes objects that count "ff" as their parent?

The `figure` associated with a subplot object `ss` is `ss.figure`
The list of axes objects associated with a figure `ff` is ff.axes.
So, you should be able to access the subplots as
ss.figure.axes

- access the x,y points as "children" of the axes object ss?

Try something like
pp.get_xdata(), pp.get_ydata()
where pp is the output of ss.plot

IMHO, it'd be easier to go:
ff = P.figure()