Rich Shepard wrote:
   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

   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:
 	    if shape == 'first shape':
 	      call functions.firstShape()
             if shape == 'second shape':
               call functions.secondShape()

   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/", line 421, in inputVals
   File "/data1/eikos/", line 542, in leftShoulderCurve
     p.plot(x, y, color='red', lw=2)
NameError: global name 'p' is not defined

I'm guessing that you do not have the following statement in your module:
which is required if you are going to use statements like:
Of course, you could simply do the following:
and then use statements like:

   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')

   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.)