3D Grid Implementation

128 views
Skip to first unread message

Christian Bilgera

unread,
Nov 10, 2015, 12:26:38 AM11/10/15
to vispy
Hello. I am quite new to using Vispy as well as PyQtGraph but I have worked with PyQtGraph longer. I have a program in which PyQtGraph could not support which is displaying 3D text above graph objects. I am starting to use Vispy but I could not find a good implementation of using 3D graph grids. I have made a custom one using the following code:

class BackgroundThread(QtCore.QThread):
    def run(self):
        view = main.canvas.central_widget.add_view()
        view.bgcolor = 'black'
        view.camera = 'turntable'
        view.padding = 100
        gscale = 15
        ginterval = 10
        griddata = np.ones(((gscale * 2 + 1) * 2, 2), np.int32)
        griddata[:, 0] = np.linspace(-gscale * ginterval, gscale * ginterval, gscale * 2 + 1).repeat(2)
        griddata[:, 1] = np.tile((-gscale * ginterval, gscale * ginterval), gscale * 2 + 1)
        glgrid = scene.visuals.LinePlot(data=griddata, color='white', line_kind='-', width=0.25, marker_size=0, connect='segments', parent=view.scene)
        griddata[:, 0] = np.tile((-gscale * ginterval, gscale * ginterval), gscale * 2 + 1)
        griddata[:, 1] = np.linspace(-gscale * ginterval, gscale * ginterval, gscale * 2 + 1).repeat(2)
        glgrid2 = scene.visuals.LinePlot(data=griddata, color='white', line_kind='-', width=0.25, marker_size=0, connect='segments', parent=view.scene)
        grid = scene.visuals.XYZAxis(parent=view.scene)

but it returns something that looks displeasing to the eye compared to what PyQtGraph offered, side by side comparison below. Vispy being the successor to PyQtGraph there has to be a solution that I'm not aware of. If someone can point this out to me it would be very helpful, thank you!

Vispy


PyQtGraph
Auto Generated Inline Image 1
Auto Generated Inline Image 2
Reply all
Reply to author
Forward
0 new messages