From: Michael Schmidt <elmickerino@gm...> - 2011-05-04 20:43:17
I'm embedding two different figures on two different canvases (each
with subplots) into a Tk application, using the TkAgg backend. I'd
like to add some matplotlib widgets to one of the figures, and I need
to specify which figure to add these to. Currently, matplotlib is
putting the widgets on the figure that was the last to be created,
which is by default the active canvas, but I need to be able to
specify which widgets go where in my code, so I need to switch the
active figure. Normally during an interactive session, I would do
something like this:
# draw some lines
# draw some more
#now to add the widgets to figure 0, I need to make this active
# and now I can add my widgets
a = axis([0.0, 0.0, 0.1, 0.1]) # --> these are now drawn on figure 0
But this won't work for embedded plots in a larger Tk program. So, my
question is, how can I select which canvas is active when I'm
embedding these figures using FigureCanvasTkAgg? I assumed there
would be a simple function like 'set_active' but I haven't found it.
I'm sure it's something simple that I'm missing.
Thanks very much,
Get latest updates about Open Source Projects, Conferences and News.