Hello everyone,
Does anyone have an idea how I could use pyqtgraph to repeat the x axis when creating a Graph?
So the x- axis goes from 0-3 and then again from 0-3?
Here is a minimal example:
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QComboBox, QVBoxLayout, QWidget
import pyqtgraph as pg
class MyWindow(QMainWindow):
def __init__(self):
super().__init__()
# Set window properties
self.setGeometry(100, 100, 1200, 800)
self.setWindowTitle("PyQt Example")
x = [0, 1, 2, 3, 0, 1, 2, 3]
y = [1, 4, 9, 6, 2, 6, 5, 8]
self.graphWidget = pg.PlotWidget(self)
# Setze die Labels für die Achsen
self.graphWidget.setLabel('left', 'Y-Achse', color='blue')
self.graphWidget.setLabel('bottom', 'X-Achse', color='green')
curve1 = self.graphWidget.plot(x, y, pen='b', symbol='o',)
layout = QVBoxLayout()
layout.addWidget(self.graphWidget)
central_widget = QWidget()
central_widget.setLayout(layout)
self.setCentralWidget(central_widget)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MyWindow()
window.show()
sys.exit(app.exec_())
Thanks
Nice day