It feels like these things were well documented and well understood under
ipython and are now less clear under jupyter. I have the following lines
in a config file ~/.jupyter/jupyter_notebook_config.py
c = get_config()
# ... Any other configurables you want to set
c.InteractiveShellApp.matplotlib = "inline"
c.InteractiveShellApp.exec_lines = ['import matplotlib.pyplot as plt',
'import numpy as np',
]
They seem to have no effect. By that I mean that I get a NameError when
trying to use np without an explicit import:
t = np.arange(0,1,0.01)
---------------------------------------------------------------------------NameError
Traceback (most recent call
last)<ipython-input-1-0268b93691c7> in <module>()----> 1 t = np.arange(0,1,0.01)
NameError: name 'np' is not defined
On Monday, August 22, 2016 at 10:57:55 AM UTC-4, Adrian Petrescu wrote:
>
> You can add it to the Jupyter server's profile. See this Stack Overflow
> answer
> <http://stackoverflow.com/questions/21176731/automatically-run-matplotlib-inline-in-ipython-notebook>
>
> for pretty much your exact scenario.
>
> Cheers!
> -Adrian
>
> On Mon, Aug 22, 2016 at 10:08 AM, Ryan Krauss <[email protected]
> <javascript:>> wrote:
>
>> I am having a hard time getting a good answer to what I think is a simple
>> question. I want my students to try the jupyter notebook and I think we
>> will pretty much always need these 3 lines at the start of every notebook
>> file:
>>
>> %matplotlib inline
>> import matplotlib.pyplot as plt
>> import numpy as np
>>
>> What is the easiest way to prevent them from having to re-type those
>> lines every time? Keep in mind that many of my students will be learning
>> python from scratch as we start my class.
>>
>> Thanks,
>>
>> Ryan
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Project Jupyter" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jupyter/e7047efc-7a68-4ee2-9aa9-aa912ee81df5%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/jupyter/e7047efc-7a68-4ee2-9aa9-aa912ee81df5%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/3db06c4c-1c91-4d68-a325-9cd43f172fa3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.