3d plot for big array

566 views
Skip to first unread message

reptile Forex

unread,
Jan 5, 2015, 5:48:32 AM1/5/15
to pyqt...@googlegroups.com
Hello,
I found this forum regarding Luke sugestion around some question about 3d plot for big array (how to).
I'm not understand main problem for this type ploting (manipulate axes). Can You explain me how this should be in python code?
The code is based on example  w.setWindowTitle('pyqtgraph example: GLLinePlotItem')

code: matrix8.py

from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph.opengl as gl
import pyqtgraph as pg
import numpy as np
 
app = QtGui.QApplication.instance()
if app == None:
    app = QtGui.QApplication([])
 
w = gl.GLViewWidget()
w.opts['distance'] = 40
w.show()
w.setWindowTitle('3D PLOT')
 
gx = gl.GLGridItem()
gx.rotate(90, 0, 1, 0)
gx.translate(-10, 0, 0)
w.addItem(gx)
gy = gl.GLGridItem()
gy.rotate(90, 1, 0, 0)
gy.translate(0, -10, 0)
w.addItem(gy)
gz = gl.GLGridItem()
gz.translate(0, 0, -10)
w.addItem(gz)
 
file = 'E:\DB\matrix8.csv';
my_data = np.loadtxt(file,delimiter=';',skiprows=1)
X = my_data[0,:]
Y = my_data[1,:]
Z = my_data[1,:]
 
n = 7
y = np.linspace(-10,10,n)
x = np.linspace(-10,10,100)
for i in range(n):
 
    yi = X
    d = Y
    z = Z
    pts = np.vstack([X,Y,Z]).transpose()
    #pts = np.array([X,Y,Z]).transpose()
 
    #yi = np.array([y[i]]*100)
    #d = (x**22 + yi**2)**0.5
    #z = 10 * np.cos(d) / (d+1)
    #pts = np.vstack([x,yi,z]).transpose()
 
    plt = gl.GLLinePlotItem(pos=pts, color=pg.glColor((i,n*1.3)), width=(i+1)/10., antialias=True)
    w.addItem(plt)
 
## Start Qt event loop unless running in interactive mode.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()

This ploting just line not surface how I expect (attachment).

plot3d-not_surfece.png

Mathew Schwartz

unread,
Jan 6, 2015, 10:33:13 PM1/6/15
to pyqt...@googlegroups.com
You are using the example "LinePlot", why would you expect it to make a surface?  You should try "GLSurfacePlot" example.

--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/c3e5af40-265c-4cf2-8841-8aba7f4d3bb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

reptile Forex

unread,
Jan 23, 2015, 3:14:58 PM1/23/15
to pyqt...@googlegroups.com
Thx for interesing in this topic. Well.. the surface in Mathematica ploting my matrix from file very long. The matrix is for small example 20000 x 500 or more. Soo.. my idea was.. forgot about surface and draw line from one row and any next row i next line. Thats why LinePlot looks more sense for me as GLSurfacePlot_3d.PNG
The surface is not to much cognitive for me.

In fact I think that this project must be droped based on Mathematica experience as long computing (around 15min as on colur surface and more for rainbow MATHEMATICA EU1.png ).
matrix10 v1.png - is as small test file as matrix.
GLSurfacePlot_3d.PNG
MATHEMATICA EU1.png
matrix10 v1.png
Reply all
Reply to author
Forward
0 new messages