2012-04-21 19:57:47 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2013-02-25 04:09:03 +00:00
|
|
|
"""
|
|
|
|
Test programmatically setting log transformation modes.
|
|
|
|
"""
|
2012-04-21 19:57:47 +00:00
|
|
|
import initExample ## Add path to library (just for examples; you do not need this)
|
|
|
|
|
|
|
|
import numpy as np
|
|
|
|
from pyqtgraph.Qt import QtGui, QtCore
|
|
|
|
import pyqtgraph as pg
|
|
|
|
|
|
|
|
|
2021-01-27 18:59:07 +00:00
|
|
|
app = pg.mkQApp("Log Axis Example")
|
2012-04-21 19:57:47 +00:00
|
|
|
|
2018-02-16 04:15:32 +00:00
|
|
|
w = pg.GraphicsLayoutWidget(show=True)
|
2013-02-25 04:09:03 +00:00
|
|
|
w.setWindowTitle('pyqtgraph example: logAxis')
|
2012-04-21 19:57:47 +00:00
|
|
|
p1 = w.addPlot(0,0, title="X Semilog")
|
|
|
|
p2 = w.addPlot(1,0, title="Y Semilog")
|
|
|
|
p3 = w.addPlot(2,0, title="XY Log")
|
|
|
|
p1.showGrid(True, True)
|
|
|
|
p2.showGrid(True, True)
|
|
|
|
p3.showGrid(True, True)
|
|
|
|
p1.setLogMode(True, False)
|
|
|
|
p2.setLogMode(False, True)
|
|
|
|
p3.setLogMode(True, True)
|
|
|
|
w.show()
|
|
|
|
|
|
|
|
y = np.random.normal(size=1000)
|
|
|
|
x = np.linspace(0, 1, 1000)
|
|
|
|
p1.plot(x, y)
|
|
|
|
p2.plot(x, y)
|
|
|
|
p3.plot(x, y)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#p.getAxis('bottom').setLogMode(True)
|
|
|
|
|
2012-12-05 05:25:45 +00:00
|
|
|
if __name__ == '__main__':
|
2021-03-22 18:17:12 +00:00
|
|
|
pg.mkQApp().exec_()
|