Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial optimization for generating plots with large number of lines #2777

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fbordignon
Copy link
Contributor

This PR attempts to integrate an initial optimization to allow for 1000s of line plots

Fixes #1039

@victorsapucaia
Copy link

I used this code snippet to test a solution for issue #1039

import pyqtgraph as pg
import numpy as np
from pyqtgraph.Qt import QtGui

lines = 10
Lx = 64
xs_short = np.arange(Lx)
h_fill = np.zeros(lines)
ys_short = np.zeros((lines,Lx))
for i in np.arange(lines):
ys_short[i,:] = np.sin(xs_short) + i
h_fill[i] = i*1.0

win1 = pg.plot()

pen = pg.mkPen(color=(255, 0, 0))
pen1 = pg.mkPen('b', width=5)

win1.plot(xs_short, ys_short,pen=pen)
win1.plot(xs_short, ys_short,fillLevel=h_fill,brush=(255, 0, 0),fillOutline=False)
win1.plot(xs_short, ys_short,fillLevel=h_fill,brush=(255, 0, 0),fillOutline=True)
win1.plot(xs_short, ys_short[0,:],fillLevel=h_fill[0],brush=(255, 0, 0))
win1.plot(xs_short, ys_short)
p = win1.plot(xs_short, ys_short, pen=pen, symbol='+',)
p = win1.plot(xs_short, ys_short, pen=pen, symbol='+',fillLevel=h_fill,brush=(255, 0, 0),fillOutline=False)
p = win1.plot(xs_short, ys_short[0,:], pen = pen, symbol ='o', symbolPen ='b', symbolBrush = 0.2, name ='blue')
p = win1.plot(xs_short, ys_short, pen = pen, symbol ='o', symbolPen ='b', symbolBrush = 0.2, name ='blue')
p.setShadowPen(pen1)

fillopts = dict(pen=pen, fillLevel=0, fillOutline=True, brush='b')
win1.plot(xs_short, ys_short[0,:], **fillopts)
fillopts = dict(pen=pen, fillLevel=h_fill, fillOutline=True, brush='b')
win1.plot(xs_short, ys_short, **fillopts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generating plots with many lines is slow
2 participants