Hi everyone,
I was looking at the matplotlib backends, and I have a question about the way
things are organized.
As of now every backend has:
* FigureManager, which corresponds to a figure + canvas + renderer + sometimes
FigureFrame.
* Canvas, which contains a single figure and a renderer.
There is also a function new_figure_manager, which is different in every
backend, and which is what ends up being used by pyplot.
The motivation behind this interface is not entirely clear to me. In particular
there are several things.
* FigureManager.__init__() does not seem to be a public interface, in particular
it is not used in pyplot.py, with new_figure_manager used instead.
* CanvasXXX.__init__() requires a figure as an argument, FigureManager requires
Canvas as an argument, new_figure_manager does not have any arguments at all.
* If I understand correct, it does not make sense to use a FigureManager from
one backend with a Canvas from another, is that so? If yes, why separate these
two? A FigureManager does not make sense without a Canvas, is a Canvas useful
without a FigureManager? Does FigureManager supply a lot of extra functionality,
that would hurt if a Canvas is used alone?
* The multilayer structure results in all the objects holding references to each
other: a Canvas has a renderer attribute, a Figure has a Canvas attribute. This
makes it nearly impossible to rebind the bunch FigureManager + Canvas + Figure.
* Why to use a very limited interface provided by new_figure_manager(), as
compared to FigureManager.__init__()?
Can you please explain what is the reason to do things this way?
Best regards,
Anton
|