Hello everyone, Does anyone have an idea how I could use pyqtgraph (PyQt5) 
to repeat the x-axis when creating a graph? So the x-axis goes from 0-3 and 
then again from 0-3 with different y-values ​​(see example x and associated 
y array)? Here is a minimal example:

[code]
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtSerialPort import *
from PyQt5.QtCore import *
import pyqtgraph as pg

class MyWindow(QMainWindow):
def __init__(self):
super().__init__()

MPU_mag = [1,2,3,1,2,3]
MPU_freq = [5, 6, 5, 3, 4, 3]

self.setGeometry(100, 100, 1500, 900)
self.setWindowTitle("BarGraph example")

hlay = QGridLayout(self)
self.graphWidget55 = pg.PlotWidget()

widget = QWidget()
widget.setLayout(hlay)
self.setCentralWidget(widget)
new_ticks = [f'{value:.2f}' for value in MPU_mag]
self.graphWidget55.getAxis("bottom").setTicks([list(zip(MPU_mag, 
new_ticks))])
self.bar_graph_item = pg.BarGraphItem(x=MPU_mag, height=MPU_freq, width=0.01, 
brush=QBrush(Qt.red))
self.graphWidget55.addItem(self.bar_graph_item)

hlay.addWidget(self.graphWidget55, 0, 0)


if __name__ == "__main__":
app = QApplication(sys.argv)
window = MyWindow()
window.show()
sys.exit(app.exec_())
[code]

thanks and nice day

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/d5c677bf-4439-42a3-82f9-f4840608e9c4n%40googlegroups.com.

Reply via email to