automatically run %matplotlib inline in jupyter qtconsole
Asked Answered
G

3

7

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

%matplotlib inline
Gape answered 20/10, 2015 at 4:24 Comment(0)
N
10

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

c.InteractiveShellApp.matplotlib = 'inline'
Niven answered 26/10, 2015 at 19:52 Comment(1)
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.Hooded
B
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')
Bulbar answered 20/1, 2016 at 14:30 Comment(1)
The ipython_config.py is, by default, under $HOME/.ipython/profile_default/ according to the documentation ipython.readthedocs.io/en/stable/development/config.htmlBonin
T
1

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

c.InteractiveShellApp.code_to_run = ''

==>

c.InteractiveShellApp.code_to_run = '%pylab inline'
Tenebrae answered 30/3, 2017 at 4:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.