Hi,

I'm here at the SciPy sprints trying to fix switching inline/gui for
the ipython notebook. I've noticed something weird about
matplotlib.use() :

    if 'matplotlib.backends' in sys.modules:
        if warn: warnings.warn(_use_error_msg)
        return
    if arg.startswith('module://'):
        name = arg
    else:
        # Lowercase only non-module backend names (modules are case-sensitive)
        arg = arg.lower()
        name = validate_backend(arg)
    rcParams['backend'] = name

Notice the return if it finds the module loaded. This return basically
makes it impossible to make use() have any effect one backends has
been loaded. However, matplotlib.pyplot.switch_backend(). Eric added
this in 2008 as a bug fix, but no more detail than that. Does anyone
have a problem putting the return with the warning? Therefore if you
pass warn=False, you can actually make the setting take effect, but
the average user won't accidentally shoot their foot off. Something
like:

    if 'matplotlib.backends' in sys.modules:
        if warn:
            warnings.warn(_use_error_msg)
            return


Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to