matplotlib ignoring .matplotlibrc?

Ahh the golden piece of information. Todd Miller has

    > reported that idle does not seem to respect matplotlibrc.
    > At this point we have no idea why. We'll try to get this
    > figured out ASAP!

I found one problem. IDLE sets the HOME variable, and there is a bug
in the way matplotlib located the rc file. Basically, if HOME is set,
it expects the rc file to be there. Here is a fix.

Edit C:\Python23\Lib\site-packages\matplotlib\__init__.py and replace
the function matplotlib_fname with the following

def matplotlib_fname():
    'Return the path to the rc file'
    if os.environ.has_key('MATPLOTLIBRC'):
        path = os.environ['MATPLOTLIBRC']
        if os.path.exists(path):
            fname = os.path.join(path, '.matplotlibrc')
            if os.path.exists(fname):
                return fname

    if os.environ.has_key('HOME'):
        path = os.environ['HOME']
        if os.path.exists(path):
            fname = os.path.join(path, '.matplotlibrc')
            if os.path.exists(fname):
                return fname

    path = get_data_path() # guaranteed to exist or raise
    fname = os.path.join(path, '.matplotlibrc')
    if not os.path.exists(fname):
        print >> sys.stderr, 'Could not find .matplotlibrc; using defaults'
    return fname

I tested this on windows with idle. Idle now respects matplotlibrc
and loads TkAgg. However, at least on my system, there is still some
idle bug because the Tk window launches and then freezes without
displaying the figure I suspect Todd, the TkAgg author, will be
looking at this soon. [Todd, I had this problem with or without
window_focus set in my test].

Sorry for the troubles,
JDH

I googled around on this and got a suggestion having to do with mainloop
handling from an old Guido e-mail. IDLE has a -n switch which you can
add to the end of the windows shortcut command line (Target:) under the
shortcut properties. When I did this, matplotlib is unfrozen. The
e-mail is a little ominous about using the switch: I think a failure in
matplotlib could also bring down IDLE and any open windows it might have
lying around (like, say, a plot script!). Guido also suggests that
running the matplotlib Tkinter mainloop in its own thread to avoid using
-n is a bad idea. This is looking dicey. We might want to make a note
that using IDLE with -n can be done but is considered risky.

Here's Guido:

Regards,
Todd

···

On Thu, 2004-04-01 at 08:55, John Hunter wrote:

I tested this on windows with idle. Idle now respects matplotlibrc
and loads TkAgg. However, at least on my system, there is still some
idle bug because the Tk window launches and then freezes without
displaying the figure I suspect Todd, the TkAgg author, will be
looking at this soon. [Todd, I had this problem with or without
window_focus set in my test].

--
Todd Miller <jmiller@...86...>