PyQtGraph – Getting X-Axis and Y-Axis Data Bounds of Graph Item
In this article we will see how we can get the x-axis or y-axis data bound covered by the graph item in PyQTGraph. PyQtGraph is a graphics and user interface library for Python that provides functionality commonly required in designing and science applications. Its primary goals are to provide fast, interactive graphics for displaying data (plots, video, etc.). A Graph is a non-linear data structure consisting of nodes and edges. The nodes are sometimes also referred to as vertices and the edges are lines or arcs that connect any two nodes in the graph. Graph consists of a finite set of vertices(or nodes) and set of Edges which connect a pair of nodes. Data bounds are the range of the axis which is occupied by the graph item.
We can create a graphic layout widget and graphic item with the help of command given below
# creating graphics layout widget win = pg.GraphicsLayoutWidget() # creating a graph item graph_item = pg.GraphItem()
In order to do this we use dataBoundsmethod with the graph item object
Syntax : imv.dataBounds(0)
Argument : It takes 0 for x-axis and 1 for y-axis as argument
Return : It returns tuple
Below is the implementation
Please Login to comment...