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

Matthias Bussonnier bussonniermatthias at gmail.com
Fri Jul 3 14:25:59 EDT 2015


Hi Brian, 

> On Jul 3, 2015, at 10:32, Brian Blais <bblais at gmail.com> wrote:
> 
> I'll continue the rant, and perhaps add a bit of a suggestion.  I come
> at this from an instructor of scientific methods, usually with
> students with no programming or command line experience - typically
> windows.  The arcane syntax (from a beginner's perspective) of
> %matplotlib inline seems to just add confusion - even while I
> understand the motivation.  In the past, it was easy enough to slap
> the command line option in the shortcut once and be done with it.
> asking the students to manually edit the IPython config files is a bit
> much for them, and in windows who knows where it is.
> 
> One possible solution, which may work to solve this is to have a
> (double-clickable) app to set some of the standard defaults, modifying
> the config files programmatically.  that way, there is one easy set up
> step after install and the problem is solved without resorting to
> command-line arguments, manually editing the config files, or manually
> importing the library in each and every notebook.


Thanks for you feedback.

But consider the following fact, you setup this for student, then they share notebook, with
someone that use the different config, or even get home, and try on their installation. 

Then the notebook don’t work, the student get confused, it was working fine at the school. 
They start asking questions and don’t get clear answer.

So basically doing so just push the frustration and incomprehention to the next person that
will teach theses student.

We did deprecate pylab and the remove the flag because of the high number
of incomprehension of people that were taught with a hidden --pylab inline
flag somewhere.

Also I’m really sure why a %matplotlib inline would be more arcane than 
python syntax, if they are beginner programmer. 

-- 
M

> 
> thanks,
> 
> Brian Blais
> 
> 
> On Thu, Jul 2, 2015 at 8:30 PM, Matthias Bussonnier
> <bussonniermatthias at gmail.com> wrote:
>> Hi William,
>> 
>> Thanks for your feedback.
>> 
>>> On Jul 2, 2015, at 17:16, William Stein <wstein at gmail.com> wrote:
>>> 
>>> <Rant>
>>> Hi,
>>> 
>>> I just want to register my frustration that by far the most common
>>> support request I get about IPython use in SageMathCloud is the
>>> following: "To display the plot, I'm tried to pl.show(), and also
>>> pl.savefig('test.png') as suggested by some answers online, but
>>> neither did the job. What is the correct command?"
>>> 
>>> The answer is "%matplotlib inline", and there is a stackoverflow
>>> question here about it:
>>> 
>>>  http://stackoverflow.com/questions/19410042/how-to-make-ipython-notebook-inline-matplotlib-graphics
>>> 
>>> I'm aware that disallowing the `--pylab inline` option when starting
>>> ipython on the command line was a choice that you made on purpose.
>> 
>> I just want to say that --pylab is deprecated, but --matplotlib still work.
>> the only difference is that --matplotlib will just not do all the imports.
>> 
>> The reason why $ipython notebook --pylab inline , or even $iptyhon notebook --matplotlib inline
>> do not work [as expected] is that that these are kernel flags that are passed to the server. It didn’t make sens
>> to pass them to the kernel as for that we needed to know what flag the kernel can receive. It special case
>> before, but making ruby kernel crashing, or wondering why some flag would be passed, and some other not.
>> 
>> So you **can** enable inline by default, you just need to set the default in a config file:
>> 
>> IPKernelApp.matplotlib=<CaselessStrEnum>
>>    Default: None
>>    Choices: ['auto', 'gtk', 'gtk3', 'inline', 'nbagg', 'notebook', 'osx', 'qt', 'qt4', 'qt5', 'tk', 'wx']
>>    Configure matplotlib for interactive use with the default matplotlib
>>    backend.
>> 
>> We did consider, and are still considering making inline the default, it just break some abstraction
>> that the kernels need to know they are started from a notebook.
>> 
>> Hope this will make you life (a bit) easier. You can also modify the kernel spec to add a --matplotlib inline to the argv
>> it should  work.
>> 
>>> No response required -- I'm just being a humble tech support person
>>> watching out for users :-)
>>> 
>>> </Rant>
>> 
>> --
>> M
>> 
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
> 
> 
> 
> -- 
> -----------------
> 
>             bblais at gmail.com
>             http://web.bryant.edu/~bblais
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev




More information about the IPython-dev mailing list