1

I'm looking for a way to configure my default notebook set up and set the size of plots and figures, so that I do not have to set it manually for each notebook individually.

I'm aware of questions like How to set the matplotlib figure default size in ipython notebook? which detail how to use jupyter_notebook_config.py.

However this isnt working, presumably because I reimport pyplot in the notebook. Is there a better way to set default settings, behaviors, options etc?

4
  • What about using plt.rc('figure', figsize=(20.0, 10.0)) (as suggested there) after importing pyplot? Commented Mar 5, 2019 at 10:10
  • @JoshFriedlander adding plt.rc('figure', figsize=(20.0, 10.0)) to ~/.ipython/profile_default/startup/startup.ipy has no effect.
    – John
    Commented Mar 5, 2019 at 11:38
  • I think this might be hard if you use matplotlib somewhere else and you want to have other settings there. How should it know if you use it out of IPython or in some other environment? However, if you only use it for IPython, are you aware of this, which refers to here? Commented Mar 5, 2019 at 13:47
  • I'm looking to set some parameters when I start the notebook server. It seems to be what jupyter_notebook_config.py is designed for, but adding commands there has not been successful.
    – John
    Commented Mar 5, 2019 at 17:28

2 Answers 2

2

In python 3.x

ipython profile create
ipython profile locate

go to the locate and edit ipython_kernel_config.py manually add the line:

c.InlineBackend.rc = {'figure.dpi':160}

rcParams references

https://matplotlib.org/3.1.1/tutorials/introductory/customizing.html

1

One away to set default plot size in matplotlib is:

from pylab import rcParams
rcParams['figure.figsize'] = 8, 6

where 8, 6 is the figure size you want to set.

1
  • 1
    I'm looking for a way to set it once as a default for all notebooks, so that I don't have to manually add it to each notebook.
    – John
    Commented Mar 5, 2019 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.