jupyter notebook - API for inline graphics in ipython -
i made small library in python can generate graphics , i'd able display object in ipython %matplotlib inline
.
is there library use make work in simple way? bonus points if display can made interactive.
from docs on how add rich display of objects: http://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display
so long control class definitions, can add _repr_*_
methods, e.g. _repr_png_
or _repr_html_
. note they're surrounded single underscores, unlike python's own magic __repr__
method. text data html should returned string, , binary data png bytes.
if don't control class definition, can register formatters separately:
get_ipython().display_formatter.formatters['image/png'].for_type(mytype, func)
Comments
Post a Comment