[IPython-dev] How IPython achieve embedding of matplotlib figure ?

Fernando Perez fperez.net at gmail.com
Fri Oct 28 19:40:13 EDT 2011

On Mon, Oct 24, 2011 at 4:51 AM, Guillaume Pichard
<guillaume.pichard at sogeti.com> wrote:
> What I would like to know is how IPython achieve this feature and how
> can I replicate it with my own Python code ? I saw that there are
> using displayhook, but how can IPython catch output from matplotlib
> functions ?
> I would be greatful if you could give me some pointers on how to do
> this feature.

We have a custom matplotlib backend that ships the figures encoded as
data in a JSON payload over ZeroMQ.  Then, each client (Qt console,
Web notebook) is responsible for decoding these messages and deciding
how to display this output.  The relevant pieces of server-side code



And each client has its own display logic, here's the Qt client
capable of displaying png/svg images:


I hope this helps...



More information about the IPython-dev mailing list