On Fri, 1 Feb 2008, Eric Firing wrote:

> What changed is that I added a warning where previously there was only a
> silent error--the matplotlib.use command was being ignored. Sometimes
> this (ignoring the command) is harmless, but it is never the user's intent
> and in some cases it can cause puzzling problems. It often occurs when a
> script or module does "from pylab import *" or "import pylab as P", and
> then later "import matplotlib; matplotlib.use('Agg')". In this example,
> the user intends to make plots non-interactively, writing them to files,
> but the whole gui machinery for the default backend (e.g., gtkagg or wxagg
> or tkagg) is imported unintentionally.

Eric,

   Thanks for the explanation. And you bring up another issue that I have:
the most appropriate way to generate non-interactive plots, written to
files, for inclusion in a ReportLab report. Do I want to use pylab for this,
plots embedded in wx, or something else?

   I need to get this module running properly so I am focusing on really
understanding how to use matplotlib to produce what we need.

> One way to find out where the warning is coming from is to invoke your script 
> as
>
> python -Werror myscript.py
>
> which will turn the warning into an error and thereby trigger an exception 
> traceback.

   OK. Tomorrow morning I'll do this.

> What this will *not* tell you is where the *earlier* call to
> matplotlib.use() is occurring. To find it you will have to trace back
> through your application, looking for the first place where pylab,
> matplotlib.pyplot, or matplotlib.backends is imported, or the first
> explicit use of matplotlib.use(), whichever is earliest.

   There are two modules in which pylab is used: reports.py and functions.py.
The former calls specific matplotlib functions in the latter.

   On the other hand, matplotlib is imported in several modules. Perhaps
that's the problem. I'll check this tomorrow, too.

Thanks,

Rich

-- 
Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to