Surface Plot Example

1,634 views
Skip to first unread message

Tom B

unread,
Dec 26, 2012, 6:46:27 AM12/26/12
to pyqt...@googlegroups.com
Hello

I'm new to pyqtgraph but really impressed with the speed...  and experimenting by substituting my data values for those in the examples.  However I would like to add x,y,z axes to the surface plot example.  I've search for examples but don't have a clue on how to achieve this.  Does anyone know of 3d surface plot examples with axes ?

Thanks
tjb

Tom B

unread,
Dec 26, 2012, 8:51:22 AM12/26/12
to pyqt...@googlegroups.com
Found the answer myself..... any recommendations on books that would help get the feel of using pyqtgraph for 3d plotting...

Luke Campagnola

unread,
Dec 26, 2012, 12:16:49 PM12/26/12
to pyqt...@googlegroups.com
I'm curious: What is the answer you found? I have not yet implemented 3D axes, but I'd be happy to point you in the right direction if you'd like to try.

There are certainly no books written on pyqtgraph. The examples are a good place to start if you haven't seen them.
It uses a fairly standard scene-graph architecture and simple OpenGL (we use version 2; version 1 is a completely different beast). I can't recommend any books on these topics (haven't read any) but I'm sure a search will turn up many tutorials. And of course I am happy to answer any questions you have, or expand on the documentation.


Luke

-- [ You are subscribed to pyqt...@googlegroups.com. To unsubscribe, send email to pyqtgraph+...@googlegroups.com ]

Tom B

unread,
Dec 26, 2012, 1:31:11 PM12/26/12
to pyqt...@googlegroups.com
I found two ways to at  least get 3 axis on the graph ... loosely speaking.
1)    w = gl.GLViewWidget() 
      g = gl.GLAxisItem()
       w.addItem(g)

2)
       xgrid = gl.GLGridItem()
       ygrid = gl.GLGridItem()
       zgrid = gl.GLGridItem()
       w.addItem(xgrid)
       w.addItem(ygrid)
       w.addItem(zgrid)

       ## rotate x and y grids to face the correct direction
       xgrid.rotate(90, 0, 1, 0)
       ygrid.rotate(90, 1, 0, 0)

In option 1 I  don't know how to annotate the axis, if possible, although there color indicates x,y,z direction, so a small improvement over no clue of direction..
In option 2 I don't know how to annotate axis and position the planes so that they form 2 adjacent sides  + top of a box, looks like by default they intersect at 0,0,0

   I would like to plot lots of x,y,z plots on 3d axis w/out  surfaces but it may take more skills than I have...

Luke Campagnola

unread,
Dec 26, 2012, 3:20:30 PM12/26/12
to pyqt...@googlegroups.com
Line plots are easy enough--see the attached files. One is a new item class that draws a 3D line plot, the other is an example script that does roughly what I think you're after. You can put them in pyqtgraph/opengl/items/ and pyqtgraph/examples/, respectively. I will probably add them in to the next revision. 

Annotating the axes, however, will take a bit more work. It is a feature I want, but don't have the time to put it together at the moment.

Luke
GLLinePlotItem.py
GLLinePlotItem_example.py

Tom B

unread,
Dec 27, 2012, 7:27:19 AM12/27/12
to pyqt...@googlegroups.com
Many Thanks... that's a good example I can build on...  
Reply all
Reply to author
Forward
0 new messages