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

寵の児 提交于 2019-12-05 03:47:37

As the error message indicates, you have not supplied the correct number of arguments to setXRange(). The correct line should look like:

p1.setXRange(5, 20, padding=0)

Documentation here: http://www.pyqtgraph.org/documentation/graphicsItems/viewbox.html#pyqtgraph.ViewBox.setXRange

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!