switching backends

Hi All, I had also been having trouble switching backends,

    > on winXP MPL 0.61. I found the reason for my problem:

    > import matplotlib import myModule #myModule includes a
    > "from matplotlib.matlab import mean" statement, which I
    > hadn't thought of matplotlib.use('GTKAgg') from
    > matplotlib.matlab import *

    > plot([1,2,3,4]) show() #This doesnt work
    > ###########################

    > import matplotlib matplotlib.use('GTKAgg') from
    > matplotlib.matlab import * import myModule

    > plot([1,2,3,4]) show() #This does work

Hi Darren,

Because you have to call 'use' before importing matplotlib.matlab,
even if the matplotlib.matlab import is done indirectly in myModule.
The backend choice is set at the time of the matplotlib.matlab import.
You might be able to work around this if necessary by issuing a use
call and the *reloading* matplotlib.matlab, though this is untested.
Of course, by reloading, I mean a proper reload, not just another
import call.

JDH