Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matplotlib giving error "OverflowError: In draw_path: Exceeded cell block limit"

I'm trying to render an image using matplotlib with 100000000 data points and it produces the error OverflowError: In draw_path: Exceeded cell block limit. Is there a limit in the amount of data points it can draw?

like image 506
Lou Avatar asked May 26 '16 20:05

Lou


3 Answers

The problem is a hardcoded limit in the number of points in the backend Agg.

Try using:

import matplotlib as mpl mpl.rcParams['agg.path.chunksize'] = 10000 

or other large value.

You can find the issue and the solution proposed here: https://github.com/matplotlib/matplotlib/issues/5907

like image 167
Serenity Avatar answered Sep 18 '22 09:09

Serenity


The problem is a hardcoded limit in the number of points in the backend Agg.

It can be solved by mpl.rcParams['agg.path.chunksize'] = 10000.

You can find the issue and the solution proposed here: https://github.com/matplotlib/matplotlib/issues/5907

like image 22
ImanolUr Avatar answered Sep 17 '22 09:09

ImanolUr


Maybe the problem is because matplotlib uses default inline plotting, which means it connects the points. There's some limit to the points for that. But if you remove inline plotting, it might work. Try

import matplotlib.pyplot as plt
plt.plot(x, y, 'ro', linestyle="None")

The 'ro' is for it to show red dots.

like image 39
Joko Maxino Avatar answered Sep 19 '22 09:09

Joko Maxino