[IPython-User] Tagging figures displayed in pylab-inline
Thu Jun 14 05:04:50 CDT 2012
Le 13 juin 2012 à 12:41, K Krish a écrit :
> Hello IPython team,
> I have a webpage built on top of the infrastructure of the notebook app to run custom algorithms on a server and display plots on the browser. I'm using pylab=inline mode to display the plots on the webpage. However, because of the way the notebook infrastructure is currently set up, whenever the server sends a figure(message type display_data) the content is fit into a container by creating a new <div> which is appended to a cell.
> Here's my question:
> I would like to choose the container to append the figure to depending on the type of figure -- so I need to include additional metadata/header info with my json message on the server side. Is there a clean way to do this without mucking around the IPython core?
> Any comment is greatly appreciated!
I would dig around IPython/zmq/displayhook.py and zmq/pylab/backend_inline.py
I think you might want to create a wrapper around fig that have a _repr_html_ in which you build the html/base64encoded figure yourself.
You will then be able to put any information you want into the div's .
You can also have a look at IPython/docs/example/notebooks/display_protocol.ipynb
That shows example of such objects and how to bind display_hooks for other objects.
> IPython-User mailing list
More information about the IPython-User