I understand how to display matplotlib plots on-screen using the pyplot interface (I think!). I started plotting in a multi-threaded program, and this started causing errors, so I am trying to switch to the object-oriented interface. I can make a simple plot and save to file using
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
fig = Figure()
can = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot((1,2,3))
can.print_figure('test')
But how do I display this plot on the screen? I have seen other code that uses can.draw() but that has no effect.
Also, please let me know if there is anything suboptimal about my code above - I haven't really got to grips with what all these figure, canvas and axes objects do yet.