object too small

25 views
Skip to first unread message

German Salazar

unread,
Sep 3, 2016, 4:45:03 PM9/3/16
to pyqtgraph
Hi, just learning pyqtgraph this weekend. 

How to do so that the object is of reasonable size? See minimal code below; the mesh created is there but is so small is difficult to find it and see it.


import numpy as np
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
import pyqtgraph.opengl as gl
from readtecplot import *

app = QtGui.QApplication([])
w = gl.GLViewWidget()
w.show()
w.setWindowTitle('Testing, testing : GLMeshItem')

verts = np.array([
 [ 0.30234799, -0.0515779 ,  1.07970929],
 [ 0.30225065, -0.05141496,  1.07969558],
 [ 0.30212766, -0.05122997,  1.07967722],
 [ 0.30197325, -0.05098886,  1.07965457],
 [ 0.30177158, -0.05065633,  1.07962561],
 [ 0.3014999 , -0.05019327,  1.07958698],
 [ 0.30113348, -0.0495578 ,  1.07953489],
 [ 0.30064803, -0.04870706,  1.07946527],
 [ 0.3000164 , -0.04759206,  1.07937408],
 [ 0.29920363, -0.04615153,  1.07925534],
 [ 0.30223119, -0.05162653,  1.07968116],
 [ 0.30213758, -0.05149585,  1.07966673],
 [ 0.30201304, -0.05133402,  1.07964694],
 [ 0.30185267, -0.05110485,  1.07962239],
 [ 0.30164   , -0.05077713,  1.0795908 ],
 [ 0.30135345, -0.05031822,  1.0795486 ],
 [ 0.3009702 , -0.04969187,  1.07949233],
 [ 0.30046719, -0.04885814,  1.07941818],
 [ 0.29981768, -0.04776869,  1.07932198],
 [ 0.29898643, -0.04636188,  1.07919788],
 [ 0.3021346 , -0.05166191,  1.07965815],
 [ 0.30204386, -0.05158708,  1.0796417 ],
 [ 0.3019183 , -0.05144618,  1.07962072],
 [ 0.30175251, -0.05122193,  1.07959461],
 [ 0.30152893, -0.05089291,  1.07956064],
 [ 0.3012276 , -0.05043378,  1.07951522],
 [ 0.30082831, -0.04981297,  1.07945514],
 [ 0.30030924, -0.04899257,  1.07937682],
 [ 0.29964384, -0.04792435,  1.07927632],
 [ 0.29879645, -0.04654595,  1.07914746]])
faces = np.array([
 [ 0, 10, 11],
 [ 0, 11,  1],
 [ 1, 11, 12],
 [ 1, 12,  2],
 [ 2, 12, 13],
 [ 2, 13,  3],
 [ 3, 13, 14],
 [ 3, 14,  4],
 [ 4, 14, 15],
 [ 4, 15,  5],
 [ 5, 15, 16],
 [ 5, 16,  6],
 [ 6, 16, 17],
 [ 6, 17,  7],
 [ 7, 17, 18],
 [ 7, 18,  8],
 [ 8, 18, 19],
 [ 8, 19,  9],
 [ 0, 20, 21],
 [ 0, 21,  1],
 [ 1, 21, 22],
 [ 1, 22,  2],
 [ 2, 22, 23],
 [ 2, 23,  3],
 [ 3, 23, 24],
 [ 3, 24,  4],
 [ 4, 24, 25],
 [ 4, 25,  5],
 [ 5, 25, 26],
 [ 5, 26,  6],
 [ 6, 26, 27],
 [ 6, 27,  7],
 [ 7, 27, 28],
 [ 7, 28,  8],
 [ 8, 28, 29],
 [ 8, 29,  9]])
colors = np.array([
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8],
 [ 0.5,  0.5,  1.,   0.8]])

## Mesh item will automatically compute face normals.
m1 = gl.GLMeshItem(vertexes=verts, faces=faces, faceColors=colors, smooth=False)
m1.setGLOptions('additive')
w.addItem(m1)

## 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_()

German Salazar

unread,
Sep 3, 2016, 9:21:03 PM9/3/16
to pyqtgraph
Ooooohhhh....scaling and translate!
Reply all
Reply to author
Forward
0 new messages