How to make a Bezier curve to connect GraphItem objects instead of straight line connections

97 views
Skip to first unread message

Shrabya Timsina

unread,
Sep 18, 2017, 12:30:17 PM9/18/17
to pyqtgraph

I am plotting a tree structure using the GraphItem class and a Viewbox in pyqtgraph 0.10. Currently I have the following image, where the dot objects

are connected by straight lines:


I need those lines to be actually curved using any Bezier function to look more like this (ignore orange boxes and line thickness):


The source code for pyqtgraph does not seem to give any hints about how those connection lines can be modified, or whether it is even allowed.

Any help would be appreciated.


Sebastian Höfer

unread,
Sep 19, 2017, 7:21:28 AM9/19/17
to pyqtgraph
Hello Shrabya,

unfortunately there's no ready-made solution in Pyqtgraph.
What you can do is to create your own GraphItem class (by inheriting from the original GrapItem) and extend the line-drawing-part with Qt's Bezier drawing functions. You can create the desired shapes with the "quadTo" and "cubicTo" functions in QPainterPath.


Cheers
Sebastian

Shrabya Timsina

unread,
Sep 19, 2017, 9:42:48 PM9/19/17
to pyqtgraph
Thank you for the guidance! Hopefully I can implement it too!
Reply all
Reply to author
Forward
0 new messages