[IPython-dev] [EXTERNAL] rant: "%matplotlib inline"

MinRK benjaminrk at gmail.com
Mon Jul 6 12:37:15 EDT 2015


What makes it trickier is that matplotlib's default behavior for 'just
works' is different whether it's in an IPython kernel or terminal IPython.
Further, the inline matplotlib backend is actually provided by IPython, it
is not in matplotlib. For this reason, I think it should be IPython's
responsibility to detect matplotlib's import and register the inline
backend.

-MinRK

On Mon, Jul 6, 2015 at 9:24 AM, Matthias Bussonnier <
bussonniermatthias at gmail.com> wrote:

>
> > On Jul 6, 2015, at 11:18, Shead, Timothy <tshead at sandia.gov> wrote:
> >
> >> On Jul 6, 2015, at 9:35 AM, Matthias Bussonnier <
> bussonniermatthias at gmail.com> wrote:
> >>
> >> I’m curious to know how you detect you are in a notebook in a reliable
> manner.
> >
> > Matthias:
> >
> > The following code gets executed once when Toyplot is imported:
> >
> >   [... snip]
> >
> > … where the “Canvas” class has a _repr_html_(self) that returns the HTML
> representation of a figure, and Canvas._autorender_list is a list of Canvas
> objects to be rendered inline.  You could imagine adapting the
> _ipython_post_execute() callback to work with arbitrary objects, including
> libraries that are completely “IPython-unaware”.
>
> Oh, ok, sure. This does not “detect” that you are in a notebook. It use
> the REPR machinery to display things in any
> fronted that would support HTML, like nbconvert, or Hydrogen.
>
> I read your previous mail as actually something like getting a boolean
> `is_notebook`.
> --
> M
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150706/4a1983c8/attachment.html>


More information about the IPython-dev mailing list