From: John H. <jdh...@ac...> - 2005-03-18 21:21:59
|
>>>>> "Fernando" == Fernando Perez <Fer...@co...> writes: Fernando> Hi all, I wonder how I can get, in an easy way, the Fernando> number of a figure returned by a call to figure(None). Fernando> The nasty way is: Fernando> allnums = [f.num for f in Fernando> _pylab_helpers.Gcf.get_all_fig_managers()] if allnums: Fernando> num = max(allnums) + 1 else: num = 1 Fernando> but this seems horrible for everyday, user-level code. Fernando> What I want to do is simply be able to make a call to: Fernando> ff=figure() Fernando> and then later make a series of plots which go to that Fernando> figure: Fernando> myplotfunc(fignum=ff.num) myplotfunc2(fignum=ff.num) ... What if we just attach the num attribute in the pylab figure function figManager.canvas.figure.num = num return figManager.canvas.figure |