I would replace the button in the bottom (unter the x-axes of the graph). I read How do I add a QPushButton to PyQtGraph using addItem? but I have no clue how I can replace the button.
Best,
import pandas as pd
import numpy as np
import glob
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
app = pg.mkQApp()
mw = QtGui.QMainWindow()
mw.setWindowTitle('Spectrum analysis')
#mw.resize(400,400) #Window size
cw = QtGui.QWidget()
proxy = QtGui.QGraphicsProxyWidget()
button = QtGui.QPushButton("Clip")
proxy.setWidget(button)
mw.setCentralWidget(cw)
l = QtGui.QVBoxLayout()
cw.setLayout(l)
pw3 = pg.PlotWidget()
l.addWidget(pw3)
mw.show()
#Plot
curve = pw3.plot(np.random.normal(size=100)*1e0, clickable=True)
curve.curve.setClickable(True)
curve.setPen('w') ## white pen
curve.setShadowPen(pg.mkPen((70,70,30), width=6, cosmetic=True))
def clicked():
print("curve clicked")
curve.sigClicked.connect(clicked)
def regionUpdate(regionItem):
lo,hi = regionItem.getRegion()
print(lo, hi)
lr = pg.LinearRegionItem([1, 30], movable=True)
lr.sigRegionChanged.connect(regionUpdate)
pw3.addItem(lr)
pw3.addItem(proxy)
if __name__ == '__main__':
pg.exec()