PyQtGraph Example

Basic PyQtGraph example.

from qtpy import QtWidgets
import numpy as np
import pyqtgraph as pg

Usually the first thing is to create a QApplication instance. Some high-level functions do this for you, but you’ll typically need to get the application instance in order to call exec_() at the end of your script anyway.

app = pg.mkQApp()

A high-level plot call:

pg.plot([1, 2, 3, 4, 5], [1, 4, 9, 16, 25])
pyqtgraph basic
<pyqtgraph.widgets.PlotWidget.PlotWidget(0x55a5bc71e630) at 0x7ff614253d40>
if __name__ == "__main__":
    app.exec_()

Total running time of the script: (0 minutes 0.176 seconds)

Gallery generated by Sphinx-Gallery