Plotting several segments in a window

28 views
Skip to first unread message

andrea gotelli

unread,
Jun 20, 2020, 8:07:41 AM6/20/20
to pyqtgraph
Hi,

In a plot I would like to display different data. This results in having some problems with performance some times. For example, I must generate a grid, that has a custom X spacing and Y spacing. To achieve that, I do the following:

# Plot the lines in a 10x10 world
for a in range( int(5/xSpacing) ):
p1.plot([a*xSpacing, a*xSpacing], [-5, 5], pen=(150, 150, 150))
p1.plot([-a*xSpacing, -a*xSpacing], [-5, 5], pen=(150, 150, 150))

for b in range( int(5/ySpacing) ):
p1.plot([-5, 5], [b*ySpacing, b*ySpacing], pen=(150, 150, 150))
p1.plot([-5, 5], [-b*ySpacing, -b*ySpacing], pen=(150, 150, 150))


This approach works. But if the lines that have to be displayed became a lot, than I experience lag.

Is there a way to plot these segments by using only one plot?

Thank you in advance.

Edmondo Giovannozzi

unread,
Jun 22, 2020, 5:39:43 AM6/22/20
to pyqtgraph

andrea gotelli

unread,
Jun 22, 2020, 6:07:21 AM6/22/20
to pyqtgraph
Thank you for the hint. I do agree with you. This library is very efficient! Considering that I started to use it since last week, and I never coded in python before, it is very intuitive! Also this community is very helpful!!
Reply all
Reply to author
Forward
0 new messages