.matplotlibrc not respected during interactive session

I am seeing some strange behavior during IPython and

    > vanilla Python interactive sessions. My .matplotlibrc is
    > not being respected. I have tried making changes to the
    > copy in my home diretory and the one in
    > /usr/share/matplotlib. If I run the commands below or do
    > an execfile('/home/darren/test.py') from an interactive
    > session, .matplotlibrc is not read. If I run the script
    > from the console, .matplotlibrc is read.

    > I'm on gentoo with either 0.63.0 or the current cvs,
    > python 2.3.3. Has anyboody else seen this?

    > from matplotlib.matlab import * a=[1,10,100,1000,10000]
    > figure(1) loglog(a,a) figure(2) plot(a,a) show()

Changes to rc made after you have started an interactive session would
not be expected to have an effect -- the rc file is parsed when any
matplotlib module is imported and not parsed again. If you make some
obvious change to the rc file in your home dir, say

figure.facecolor : g # figure facecolor; 0.75 is scalar gray

and *restart* ipython, do the changes take effect?

Note that you don't need to execfile with ipython, since that is what
the ipython 'run' command is for, and run does some smart things
before exec-ing your file, namely turning interactive off for the
duration of the run, which is more efficient.

There has been some interest in a loadrc command, which would be used
to load a specified rc file from the command line or script. Should
be easy to add, and it is on the todo list.

Note that matplotlib in CVS has a new verbose setting which is
described at the bottom of the rc file. By changing the verbose
setting to helpful, it will give you diagnostic information when you
run, including which rc file is loaded. If you continue having
trouble with this, I suggest grabbing the latest from CVS and try
running with verbose : helpful.

JDH

I understand that these .matplotlibrc changes must be made before importing
matplotlib. The problem I was having was that the file was not being read
when starting ipython -pylab. I have reinstalled MPL a couple times now, and
can't reproduce the problem.

Darren

···

On Wednesday 13 October 2004 09:22 am, John Hunter wrote:

    > I am seeing some strange behavior during IPython and
    > vanilla Python interactive sessions. My .matplotlibrc is
    > not being respected. I have tried making changes to the
    > copy in my home diretory and the one in
    > /usr/share/matplotlib. If I run the commands below or do
    > an execfile('/home/darren/test.py') from an interactive
    > session, .matplotlibrc is not read. If I run the script
    > from the console, .matplotlibrc is read.

    > I'm on gentoo with either 0.63.0 or the current cvs,
    > python 2.3.3. Has anyboody else seen this?

    > from matplotlib.matlab import * a=[1,10,100,1000,10000]
    > figure(1) loglog(a,a) figure(2) plot(a,a) show()

Changes to rc made after you have started an interactive session would
not be expected to have an effect -- the rc file is parsed when any
matplotlib module is imported and not parsed again. If you make some
obvious change to the rc file in your home dir, say