Quantcast

Backends object structure

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Backends object structure

Anton Akhmerov
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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Backends object structure

Anton Akhmerov
To give a little bit more context, I want to implement a function
which attaches a figure constructed via OO interface to pyplot.
It seems that the only way to do so now is to go over all the backends,
modify new_figure_manager to accept a figure argument, detect the
backend used by pyplot, and use the modified new_figure_manager.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Loading...