pyqtgraph, plotting time series

后端 未结 1 486
一生所求
一生所求 2021-01-22 01:18

I\'am trying to plot time serie with pyqtgraph. I\'ve read this, this and this. But i\'am not sure how to correctly use it.

My plot is a plot widget, and i use it this

相关标签:
1条回答
  • 2021-01-22 01:46

    I finally solved my problem, it was quite easy.

    I just needed to initialize my plot widget that way:

        date_axis = pg.graphicsItems.DateAxisItem.DateAxisItem(orientation = 'bottom')
        self.graph = pg.PlotWidget(axisItems = {'bottom': date_axis})
    

    and plot my data that way:

        graph.plot(x = useful_values_dict['useful_data']['data']['timestamp_dates'],
                   y = useful_values_dict['useful_data']['data'][raw_header],
                   pen=pg.mkPen(color=colors[count],width=1,style=QtCore.Qt.SolidLine))
    

    with x data as an array of timestamp.

    Thanks !

    0 讨论(0)
提交回复
热议问题