I am attempting to build a pyqtgraph app in which I can have the axis labels and ticks placed inside the plot window rather than outside and I would also like to reverse the scales on the axes.Is there an easy way to do this or would I need to subclass AxisItem and code my own extensions?
import pyqtgraph as pgw = pg.GraphicsWindow()vb = w.addViewBox()grid = pg.GridItem()vb.addItem(grid)vb.invertY()
import pyqtgraph as pgclass ViewWithAxes(pg.ViewBox):def __init__(self):pg.ViewBox.__init__(self)self.invertY()self.axis1 = pg.AxisItem(orientation='right', linkView=self, maxTickLength=10)self.axis1.setParentItem(self)def resizeEvent(self, ev):self.axis1.setMinimumHeight(self.height())self.axis1.setMaximumHeight(self.height())return pg.ViewBox.resizeEvent(self, ev)w = pg.GraphicsWindow()vb = ViewWithAxes()w.addItem(vb)
I have managed to flip the Y axis, but is there a way to flip the X axis as well? I noticed that there wasn't an invertY method for the AxisItem, but logically the function would be the same as for the Y so I could simply add a function, couldn't I?