I'm hoping that someone's already addressed the need I have so I don't
need to re-invent this wheel. But, if no one has a ready-made solution, I
still need some expert advice in how to build this wheel myself.

   My python application uses the wxPython widget library, SQLite (using the
pysqlite2 library), ReportLab for the reports, and matplotlib for data
plotting. Right now my attention is on writing the function(s) that plot
multiple curves on a common axes set for inclusion in a PDF report. I've
been struggling with this for several days without tripping over the
solution.

   Here's what I'm trying to do, using a town for an analogy. The data on
towns, streets, and houses are stored in database tables. What I want are
plots of all house shapes on each street in each town, in .png format for
inclusion in the ReportLab output. There can be from 1 to 7 houses per
street, and the shapes are defined as distribution curves (e.g., Bell, S-,
Z-, trapezoidal curves).

   In pseudocode, this is what I have:
        for each town:
          for each street:
            hold(True)
            if shape == 'first shape':
              call functions.firstShape()
             if shape == 'second shape':
               call functions.secondShape()
     etc.
             hold()

   This does not work. First, 'hold()' is not known in this module, but all
appropriate matplotlib components are imported. Second, I must not have the
functions correctly written; for example, this error:

   File "/data1/eikos/reports.py", line 421, in inputVals
     functions.leftShoulderCurve(self.row[10],self.row[11],self.row[9])
   File "/data1/eikos/functions.py", line 542, in leftShoulderCurve
     p.plot(x, y, color='red', lw=2)
NameError: global name 'p' is not defined

   And here is functions.leftShoulderCurve:

def leftShoulderCurve(hl, hr, lr):
   hiLeft = hl
   hiRight = hr
   lowRight = lr
   x, y = zip(*[(hiLeft, 1.0), (hiRight, 1.0), (lowRight, 0.0)])
   p.plot(x, y, color='red', lw=2)
   p.axis([0, 100, 0.0, 1.0])
   p.xlabel('Universe of Discourse')
   p.ylabel('Membership Grade')
   p.show()

   If I add instance reference of 'self' prepended to 'p.', that throws the
same error.

   What I need is guidance on where to start to be able to produce these
plots. (Display of individual curves will be addressed after I get the
report completed.)

TIA,

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