pyqtgraph/examples/LogPlotTest.py

38 lines
1.0 KiB
Python
Raw Normal View History

2013-02-13 18:00:50 +00:00
# -*- coding: utf-8 -*-
2013-02-25 04:09:03 +00:00
"""
Simple logarithmic plotting test
"""
2013-02-13 18:00:50 +00:00
import initExample ## Add path to library (just for examples; you do not need this)
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
app = QtGui.QApplication([])
win = pg.GraphicsWindow(title="Basic plotting examples")
win.resize(1000,600)
2013-02-25 04:09:03 +00:00
win.setWindowTitle('pyqtgraph example: LogPlotTest')
2013-02-13 18:00:50 +00:00
p5 = win.addPlot(title="Scatter plot, axis labels, log scale")
x = np.random.normal(size=1000) * 1e-5
y = x*1000 + 0.005 * np.random.normal(size=1000)
y -= y.min()-1.0
mask = x > 1e-15
x = x[mask]
y = y[mask]
p5.plot(x, y, pen=None, symbol='t', symbolPen=None, symbolSize=10, symbolBrush=(100, 100, 255, 50))
p5.setLabel('left', "Y Axis", units='A')
p5.setLabel('bottom', "Y Axis", units='s')
p5.setLogMode(x=True, y=False)
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()