7

Is there a way to change the config file to make jupyter qtconsole run the following command on startup?:

%matplotlib inline
Alexander
  • 105,104
  • 32
  • 201
  • 196

3 Answers3

10

Add this line to the ipython_config.py file (not the ipython_qtconsole_config.py file):

c.InteractiveShellApp.matplotlib = 'inline'
Alexander
  • 105,104
  • 32
  • 201
  • 196
screenpaver
  • 1,120
  • 8
  • 14
  • 2
    Awesome. I was unaware of all the customization that could be done with the ipython_config.py file... If anyone else doesn't already have that file, run `ipython profile create`. – userABC123 Dec 15 '15 at 04:17
4

In your ipython_config.py file you can specify commands to run at startup (including magic % commands) by setting c.InteractiveShellApp.exec_lines. For example,

c.InteractiveShellApp.exec_lines = """
%matplotlib inline
%autoreload 2
import your_favorite_module
""".split('\n')
Amit Moscovich
  • 2,858
  • 1
  • 21
  • 12
  • 2
    The `ipython_config.py` is, by default, under `$HOME/.ipython/profile_default/` according to the documentation http://ipython.readthedocs.io/en/stable/development/config.html – Evgeni Sergeev Sep 03 '16 at 12:04
1

Open the file ~/.ipython/profile_default/ipython_config.py, and

c.InteractiveShellApp.code_to_run = ''

==>

c.InteractiveShellApp.code_to_run = '%pylab inline'
Dean Wong
  • 116
  • 4