pyqtgraph

More information at http://pyqtgraph.org.

PyQtGraph is a pure-python graphics and GUI library built on PyQt4 / PySide and numpy. It is intended for use in mathematics / scientific / engineering applications. Despite being written entirely in python, the library is very fast due to its heavy leverage of numpy for number crunching and Qt's GraphicsView framework for fast display.

Matplotlib is more or less the de-facto standard plotting library for python. If you are starting a new project and do not need any of the features specifically provided by pyqtgraph, you should start with matplotlib. It is much more mature, has an enormous user community, and produces very nice publication-quality graphics.

Reasons you might want to use pyqtgraph instead:

  • Speed. If you are doing anything requiring rapid plot updates, video, or realtime interactivity, matplotlib is not the best choice. This is (in my opinion) matplotlib's greatest weakness.
  • Portability / ease of installation. PyQtGraph is a pure-python package, which means that it runs on virtually every platform supported by numpy and PyQt, no compiling required. If you require portability in your application, this can make your life a lot easier.
  • Many other features--pyqtgraph is much more than a plotting library; it strives to cover many aspects of science/engineering application development with more advanced features like its ImageView and ScatterPlotWidget analysis tools, ROI-based data slicing, parameter trees, flowcharts, multiprocessing, and more.

Simple Example

In [ ]:
# It may be necessary to restart the Notebook Kernel, as 
# only one QApplication instance can exist at a time
import numpy as np
from PySide import QtGui, QtCore 
# this will force pyqtgraph to use PySide instead of PyQt4
import pyqtgraph as pg

app = QtGui.QApplication([])
win = pg.GraphicsWindow(title="Title")
win.resize(800, 600)
p = win.addPlot(title="Plot")

y = np.random.randn(100)
p.plot(y, pen="b")
p.plot(np.cumsum(y), pen="g")

app.exec_() # for PySide only

More Examples

In [ ]:
# It may be necessary to restart the Notebook Kernel, as 
# only one QApplication instance can exist at a time
import pyqtgraph.examples
pyqtgraph.examples.run()