Max matplotlib matrix array size?

I created a program that retrieves data from a device through a serial port every half second or so. Then it adds this data to the array, which sets the data points, and then updates the graph. Everything goes fine until it works for an hour or so, after which the program stops responding.

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

0
source share
2 answers

Using the code below, I was able to get matplotlib to show a simple graph of ten million points. I suspect the problem is not the size of the array.

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()
+1
source

There seems to be 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.
0
source

Source: https://habr.com/ru/post/1532233/


All Articles