From: Ryan M. <rm...@gm...> - 2012-07-20 19:35:30
|
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 |