2

I've created a program that retrieves data from a device on the serial port every half second or so. It then appends that data to the array that sets the data points and then updates the plot. Everything goes fine until it's been running for an hour or so, at which point the program stops responding.

Does anyone know if there is a size limit for this array? If anyone has any ideas on handling a data set that could be millions of points, I would love to hear your thoughts.

5
  • 2
    Perhaps you should post your code and the error message. Commented Nov 30, 2012 at 20:47
  • You might want to specify your platform, the version of matplotlib and the backend you're using. Commented Nov 30, 2012 at 20:47
  • A minimal but complete example that demonstrates the problem would also be helpful. Commented Nov 30, 2012 at 20:49
  • I'm writing this in python on a windows system using the QtAgg4 back end. I've written a simplified version, and I've gotten well past 100,000 points, so, I know it's not as simple as just having too many points. I wish I could post my code, but, it's several very large classes. My biggest problem, is that I don't get an error message, it just stops responding. Commented Nov 30, 2012 at 20:56
  • Another thing that I noticed was that the program will run twice as long if it's running as an executable as opposed to running in my eclipse IDE. Commented Nov 30, 2012 at 21:11

2 Answers 2

5

Using the code below I was able to get matplotlib to show a simple graph of ten million points. I suspect the problem isn't with the array size.

import numpy as np
import matplotlib.pyplot as plt
import random

nsteps = 10000000
draws = np.random.randint(0,2,size=nsteps)
steps = np.where(draws>0,1,-1)
walk = steps.cumsum()
plt.plot(np.arange(nsteps), np.array(walk), 'r-')
plt.title("Big Set Random Walk with $\pm1$ steps")
plt.show()
Sign up to request clarification or add additional context in comments.

2 Comments

Fair enough. Does anyone know of any tools I can use to determine what is causing the lock up?
Given Akavall's comment, this must depend at least in part on the chart type.
1

There seems to be a some limit. I just tried

import pylab
import numpy as np

n = 10000000 # my code works fine for n = 1000000

x = np.random.normal(0,1,n)

pylab.plot(x)

pylab.show()

And got the following error:

OverflowError: Agg rendering complexity exceeded. Consider downsampling or decimating your data.

1 Comment

10 million data points at about 2 data points per second would be roughly 1300 hours of polling, that would probably work for me. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.