[IPython-dev] matplotlibrc seems to be ignored from IPython notebook

Min RK benjaminrk at gmail.com
Wed May 8 12:28:23 EDT 2013


Did you not receive my reply yesterday?  Yes, it is only the inline backend that sets a few defaults.

Resending:

It is not ignored, but IPython sets a few of its own defaults with the InlineBackend.rc config . One of these is savefig.dpi.  You can prevent this by simply clearing the inline backend rc with:

c.InlineBackend.rc = {}

in your config file.

-MinRK

On May 8, 2013, at 9:20, Richard Stanton <stanton at haas.berkeley.edu> wrote:

> A quick follow-up:
> 
> Even in an Ipython notebook, the code works as expected if I start the
> notebook server with the command
> 
> ipython notebook --pylab
> 
> It fails (i.e., it ignores the dpi settings in matplotlibrc) if I start
> the notebook server with the command
> 
> ipython notebook --pylab inline
> 
> So the problem seems to be with the use of the inline option.
> 
> 
> 
> 
> 
> 
> On 5/7/13 8:04 PM, "Richard Stanton" <stanton at haas.berkeley.edu> wrote:
> 
>> I want to increase the default setting of saved matplotlib graphs, so I
>> created a file ~/.matplotlib/matplotlibrc containing the line
>> 
>> savefigdpi : 300
>> 
>> I then created a test notebook containing a single cell with the contents
>> 
>> import numpy as np
>> import matplotlib.pyplot as plt
>> x = np.array([1,2,3])
>> y = np.array([4,5,6])
>> plt.plot(x,y)
>> plt.savefig('d0.png')
>> plt.savefig('d300.png',dpi=300)
>> 
>> 
>> When I run this within the notebook, the two png files are created fine,
>> but have different sizes. When I run the same code from the command line
>> (after saving the same commands to a script file testplot.py), using
>> 
>> ipython testplot.py
>> 
>> the two graphs have the same size, as desired. Does matplotlib ignore the
>> contents of ~/.matplotlib/matplotlibrc when called from an Ipython
>> notebook?
>> 
>> By the way, this is using matplotlib 1.2.0 and Ipython 0.13.2, if it makes
>> any difference.
>> 
>> Thanks for any help.
>> 
>> Richard Stanton
> 
> _______________________________________________
> 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