Andrew,

The traceback shows that you are tripping over something that has been 
changed since the version you are using, so it might work if you update 
your mpl, preferably from svn.  I think the relevant change was made by 
John quite recently, but I haven't looked it up.

Eric

Andrew Jaffe wrote:
> Hi John,
> 
> Thanks for the very fast response, but it doesn't quite work for my use 
> case. I don't know if it's because my default is interactive, or ipython 
> on general, or something else...
> 
> n21:~/work/Pointing> ipython -pylab -nobanner
> 
> In [1]: switch_backend('Agg')
> /usr/local/src/python-2.5.2/lib/python2.5/site-packages/matplotlib/__init__.py:753:
>  
> UserWarning:  This call to matplotlib.use() has no effect
> because the the backend has already been chosen;
> matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
> or matplotlib.backends is imported for the first time.
> 
>    warnings.warn(_use_error_msg)
> ---------------------------------------------------------------------------
> NameError                                 Traceback (most recent call last)
> 
> /home/jaffe/work/Pointing/<ipython console> in <module>()
> 
> /usr/local/src/python-2.5.2/lib/python2.5/site-packages/matplotlib/pyplot.py 
> in switch_backend(newbackend)
>       52     global new_figure_manager, draw_if_interactive, show
>       53     matplotlib.use(newbackend)
> ---> 54     reload(backends)
>       55     from backends import new_figure_manager, 
> draw_if_interactive, show
>       56
> 
> NameError: global name 'backends' is not defined
> 
> In [2]:
> 
> 
> 
> 
> John Hunter wrote:
>> On Fri, Jun 27, 2008 at 12:52 PM, Andrew Jaffe <[EMAIL PROTECTED]> wrote:
>>> Hi all,
>>>
>>> All the usual apologies if this is a FAQ, but I can't find it.
>>>
>>> Is there any way to change the backend interactively when using ipython?
>> Take a look at the pylab/pyplot switch_backends function
>>
>>
>> switch_backend(newbackend)
>>     Switch the default backend to newbackend.  This feature is
>>     **experimental**, and is only expected to work switching to an
>>     image backend.  Eg, if you have a bunch of PostScript scripts that
>>     you want to run from an interactive ipython session, you may want
>>     to switch to the PS backend before running them to avoid having a
>>     bunch of GUI windows popup.  If you try to interactively switch
>>     from one GUI backend to another, you will explode.
>>
>>     Calling this command will close all open windows.
>>
>> Eg:
>>
>>>>> switch_backends('Agg')
>> JDH
>>
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
> 
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to