pxDislin help

Paul Magwene paul.magwene at yale.edu
Mon Mar 27 20:38:01 EST 2000


John Fisher wrote:
> 
> Hi folks,
> 
> I'm having some trouble with the pxDislin module.  I'm unable to get
> matrix surfaces to work.  A simple example of my problem:
> 
> >>> from pxDislin import *
> >>> from Numeric import *
> >>> x = [1,2]
> >>> y = [1,2]
> >>> z = reshape(arange(4),(2,2))
> >>> sp = dMatrixSurface(x,y,z)
> >>> sp.show()
>  <<<< Warning   3: Incorrect level in color!   (   0)
>  <<<< Warning   3: Incorrect level in survis!   (   0)
>  <<<< Warning   3: Incorrect level in surclr!   (   0)
>  <<<< Warning   3: Incorrect level in shdmod!   (   0)
>  <<<< Warning   3: Incorrect level in surmsh!   (   0)
>  <<<< Warning   3: Incorrect level in surfce!   (   0)
> 
> I'm sure I'm forgetting something obvious, but I haven't been able to
> find any examples of how to use dMatrixSurface in the pxDislin package.
> 
> Thanks,
> John

John,

You're problem is that dMatrixSurface knows how to draw itself, but
doesn't know how to make all the DISLIN calls and axis setup that are
required before that can happen.

All plots using the pxDislin package must consist of at least two
objects:

1.  A plot object (dPlot or one of its subclasses)
2.  An axis object (dAxis or one of its subclasses)

Once you've set those up, you can add other objects (such as
dMatrixSurface) to the plot's drawing queue.

All this is explained in the long doc-string at the beginning of the
pxDislin.py file (and in the HTML docs that come with the distribution).

Here's an example of what you want to do:

>>> from pxDislin import *
>>> from Numeric import *
>>> p = dPlot3D()
>>> a = dAxis3D(0,5,0,5,0,5)
>>> p.axis = a
>>> x = [1,2]
>>> y = [1,2]
>>> z = reshape(arange(4),(2,2))
>>> s = dMatrixSurface(x,y,z)
>>> p.add(s)
>>> p.show()

What I imagined confused you is that most of the demos utilize classes
defined in pxDplot and pxDplot3D.  Those two modules provide some higher
level abstraction by automatically defining a plot object, setting up
(somewhat) appropriate axes, and adding the necessary drawing objects. 
If the (somewhat limited) classes in those two modules provide all the
functionality you need, than great, but if you need to define a
different type of plot, it's easy to derive your own.  Use the provided
classes as templates for your own.  If you come up with some useful plot
objects than submit 'em to me and I'll include 'em in an upcoming
distribution.

Keep your eyes open for the next release of pxDislin (v0.4), which will
include a plug-in to IDLE which will make plot construction more
visually interactive.  I'll also make sure to update the documentation
and examples to make things clearer.

Enjoy,
Paul

-- 

Paul Magwene
paul.magwene at yale.edu



More information about the Python-list mailing list