Very slow when set pen width to 6 for large data

769 views
Skip to first unread message

Jianbin Kang

unread,
Oct 6, 2013, 12:46:19 PM10/6/13
to pyqt...@googlegroups.com
Hi

For example:
I modified the example 'widget' -> 'PlotWidget'
line 71-74:
curve = pw3.plot(np.random.normal(size=100000)*1e0, clickable=True)
curve.curve.setClickable(True)
curve.setPen('w')  ## white pen
curve.setShadowPen(pg.mkPen((70,70,30), width=6, cosmetic=True))

I set data number to 100000.
I found that the GUI became very very slow.

But it works ok if I set shadow pen width=1:
curve.setShadowPen(pg.mkPen((70,70,30), width=1, cosmetic=True))

If I need to plot large data with thick pen, is there any solution?

Luke Campagnola

unread,
Oct 6, 2013, 1:05:37 PM10/6/13
to pyqt...@googlegroups.com
Unfortunately I have not found any way to speed up drawing thick lines in Qt. For now, the best thing you can to is reduce the amount of data being drawn. In the developmental version (available on github), there are new features to automatically downsample the data based on the density of samples and the range visible in the viewbox.

Luke
 

Jianbin Kang

unread,
Oct 6, 2013, 9:13:35 PM10/6/13
to pyqt...@googlegroups.com
I tried to use polygon instead of QPainterPath.
It seems that polygon is faster than path on thick lines.
So why does pyqtgraph choose to use path?

Thanks for your great work!



2013/10/7 Luke Campagnola <luke.ca...@gmail.com>

--
-- [ You are subscribed to pyqt...@googlegroups.com. To unsubscribe, send email to pyqtgraph+...@googlegroups.com ]
---
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Luke Campagnola

unread,
Oct 6, 2013, 10:03:01 PM10/6/13
to pyqt...@googlegroups.com
On Sun, Oct 6, 2013 at 9:13 PM, Jianbin Kang <kjb...@gmail.com> wrote:
I tried to use polygon instead of QPainterPath.
It seems that polygon is faster than path on thick lines.
So why does pyqtgraph choose to use path?


Interesting! I use QPainterPath mainly because it has the ability to omit line segments. I didn't see any performance differences between path and polygon, but I never tested with wider lines. I'll definitely keep this in mind, thank you!

Luke

Luke M

unread,
Jun 19, 2014, 9:03:24 AM6/19/14
to pyqt...@googlegroups.com
I hate to resurrect an old topic, but I was having some speed trouble and I finally tracked it down to this. I was using a width of 1.5, and changing it back to 1 made a huge difference. I assume that anything over 1 introduces additional calculations that slow the process down significantly for larger data sets (I'm looking at around 100,000 samples). In the time since this discussion have you had any other thoughts about how to improve performance?
 
Downsampling does help a bit, but not quite enough.
 
 

Jianbin Kang

unread,
Jun 21, 2014, 6:53:45 AM6/21/14
to pyqt...@googlegroups.com
Looks like it is not due to pyqtgraph. It is slow in C++ too. Seems it is a problem of Qt.



2014-06-19 21:03 GMT+08:00 Luke M <lcj...@gmail.com>:
I hate to resurrect an old topic, but I was having some speed trouble and I finally tracked it down to this. I was using a width of 1.5, and changing it back to 1 made a huge difference. I assume that anything over 1 introduces additional calculations that slow the process down significantly for larger data sets (I'm looking at around 100,000 samples). In the time since this discussion have you had any other thoughts about how to improve performance?
 
Downsampling does help a bit, but not quite enough.
 
 

--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.

Luke Campagnola

unread,
Jun 22, 2014, 10:21:49 AM6/22/14
to pyqt...@googlegroups.com
On Sat, Jun 21, 2014 at 6:53 AM, Jianbin Kang <kjb...@gmail.com> wrote:
Looks like it is not due to pyqtgraph. It is slow in C++ too. Seems it is a problem of Qt.

Agreed. I did some testing with QGraphicsPolygonItem and didn't see any significant differences. I think we will need to wait for either Qt or vispy to provide faster solutions.
 

Luke M

unread,
Jun 23, 2014, 10:31:23 AM6/23/14
to pyqt...@googlegroups.com
OK, good to know. Thanks! 
Reply all
Reply to author
Forward
0 new messages