From: John H. <jdh...@ac...> - 2004-09-06 04:43:03
|
>>>>> "Darren" == Darren Dale <dd...@co...> writes: Darren> Hi All, I had also been having trouble switching backends, Darren> on winXP MPL 0.61. I found the reason for my problem: Darren> import matplotlib import myModule #myModule includes a Darren> "from matplotlib.matlab import mean" statement, which I Darren> hadn't thought of matplotlib.use('GTKAgg') from Darren> matplotlib.matlab import * Darren> plot([1,2,3,4]) show() #This doesnt work Darren> ########################### Darren> import matplotlib matplotlib.use('GTKAgg') from Darren> matplotlib.matlab import * import myModule Darren> 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 |