pyqtgraph/examples/LogPlotTest.py

35 lines
888 B
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 = pg.mkQApp("Log Plot Example")
2013-02-13 18:00:50 +00:00
win = pg.GraphicsLayoutWidget(show=True, title="Basic plotting examples")
2013-02-13 18:00:50 +00:00
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)
if __name__ == '__main__':
2021-05-13 21:28:22 +00:00
pg.exec()