Skip to content Skip to sidebar Skip to footer

Pyqtgraph Limit Zoom To Upper/lower Bound Of Axes

so Pyqtgraph automatically computes the axis and rescales upon zooming, and this is fine. However I have two axes, frequency and hour. Frequency can take any value between 0-100 an

Solution 1:

I know this is an old one but just in case anyone else needs a solution. The user can be stopped from zooming out past the axis limits by getting the current axis (assumed to be the maximum out-zoom) and setting these values as the range for the view box.

e.g.

range_ = graph.getViewBox().viewRange() 
graph.getViewBox().setLimits(xMin=range_[0][0], xMax=range_[0][1],   
                             yMin=range_[1][0], yMax=range_[1][1])   

Documentation: https://pyqtgraph.readthedocs.io/en/latest/graphicsItems/viewbox.html

Post a Comment for "Pyqtgraph Limit Zoom To Upper/lower Bound Of Axes"