Python pyqtgraph how to set x and y axis limits on graph, no autorange

后端 未结 3 1170
-上瘾入骨i
-上瘾入骨i 2021-02-20 11:31

I would like to know how I can set the x and y axis limits that are displayed for a pyqtgraph.GraphicsWindow.addPlot object. I need to display a lot of data inside a loop (hence

3条回答
  •  星月不相逢
    2021-02-20 12:08

    Michael.

    The easiest way would be to simply specify your ranges as elements of a list. Replace the p1.setXRange with something like this:

    p1.setRange(xRange=[5,20])
    

    And that's it!

    Check the documentation of this class in: http://www.pyqtgraph.org/documentation/graphicsItems/viewbox.html#pyqtgraph.ViewBox.setRange

提交回复
热议问题