Python Forum
plotting 2d and 3d using pyqt5 and pyqtgraph and GLSurfacePlotItem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
plotting 2d and 3d using pyqt5 and pyqtgraph and GLSurfacePlotItem
#2
never mind, I solved it

class MainWindow(QtWidgets.QMainWindow):

    def __init__(self, *args, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)

        #Load the UI Page
        uic.loadUi('MainWindow.ui', self)

        self.setup2d_graphs()
        self.setup3d_inv()
        
        self.plot([1,2,3,4,5,6,7,8,9,10], [30,32,34,32,33,31,29,32,35,45])

    def setup3d_inv(self):
        self.graphWidget.setCameraPosition(distance=50)
        ## Add a grid to the view
        g = gl.GLGridItem()
        g.scale(1, 1, 1)
        g.setDepthValue(100)  # draw grid after surfaces since they may be translucent
        self.graphWidget.addItem(g)
    
    def plot(self, hour, temperature):
        Z = np.ones((2, 2))
        p1 = gl.GLSurfacePlotItem(z=Z, shader='shaded', color=(0.5, 0.5, 1, 1))
        self.graphWidget.addItem(p1)
        
        # self.graphWidget.plot(hour, temperature)
        a = np.random.randn(150)
        b = np.random.randn(150)
        self.graphWidget_2D.plot          (np.sort(a), np.sort(b))


def main():
    app = QtWidgets.QApplication(sys.argv)
    main = MainWindow()
    main.show()
    sys.exit(app.exec_())

if __name__ == '__main__':         
    main()
Reply


Messages In This Thread
RE: plotting 2d and 3d using pyqt5 and pyqtgraph and GLSurfacePlotItem - by kiyoshi7 - Jan-20-2020, 12:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 2,815 Apr-06-2019, 11:15 PM
Last Post: ZenWoR

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020