I try to plot time series with Plotly. Graphs typically contain 200 000 rows and 10 curves resulting in a 80Mo html files. But this 200 000 rows is limited by the MemoryError
raised by Plotly, and this is very limiting my studies.
py.plot(fig, filename=self.filename, auto_open=True)
File "C:\Users\Max\AppData\Local\Programs\Python\Python38-32\lib\site-packages\plotly\offline\offline.py", line 586, in plot
pio.write_html(
File "C:\Users\Max\AppData\Local\Programs\Python\Python38-32\lib\site-packages\plotly\io\_html.py", line 508, in write_html
html_str = to_html(
File "C:\Users\Max\AppData\Local\Programs\Python\Python38-32\lib\site-packages\plotly\io\_html.py", line 137, in to_html
jdata = json.dumps(
File "C:\Users\Max\AppData\Local\Programs\Python\Python38-32\lib\json\__init__.py", line 234, in dumps
return cls(
File "C:\Users\Max\AppData\Local\Programs\Python\Python38-32\lib\site-packages\_plotly_utils\utils.py", line 60, in encode
return _json.dumps(
File "C:\Users\Max\AppData\Local\Programs\Python\Python38-32\lib\json\__init__.py", line 234, in dumps
return cls(
File "C:\Users\Max\AppData\Local\Programs\Python\Python38-32\lib\json\encoder.py", line 202, in encode
return ''.join(chunks)
MemoryError
I already implemented downsizing (like this topic suggests), and also rounding values to a limited number of decimals to avoid having to big .html files. But still it is not enough.
Also, for example when plotting 10 curves, even if they share the same X axis, the html file will contain 10 times the same X vector. Is there a way to improve that?
When I look at the memory while Plotly is concatenating data and when it stops working, it seems to be utilizing only 500Mo of RAM while my computer memory is far from being full, with still 1 or 2 Go of RAM free. Thus I don't understand why this MemoryError
is raised. Is there a dedicated memory space parameter somewhere in Plotly or Python options?
I am even ready to use any other library that would allow me to draw large graphs as long as they provide sufficient interactivity. For example Matplotlib is able to draw large time series when Plotly cannot, but it is way less interactive. This one seems super light and dedicated to time series, but I did not find any Python package of it and it would require to develop the Python interface from scratch.