2017-09-05 41 views
1

我试图用plotly绘制大量数据点(2mm-3mm)的东西。plotly:数量庞大的数据点

当我运行

py.iplot(fig, filename='test plot') 

我收到以下错误:

Woah there! Look at all those points! Due to browser limitations, the Plotly SVG drawing functions have a hard time graphing more than 500k data points for line charts, or 40k points for other types of charts. Here are some suggestions: 
(1) Use the `plotly.graph_objs.Scattergl` trace object to generate a WebGl graph. 
(2) Trying using the image API to return an image instead of a graph URL 
(3) Use matplotlib 
(4) See if you can create your visualization with fewer data points 

If the visualization you're using aggregates points (e.g., box plot, histogram, etc.) you can disregard this warning. 

于是我尝试将它与这个保存:

py.image.save_as(fig, 'my_plot.png') 

但后来我得到这个错误:

PlotlyRequestError: Unknown Image Server Error 

我该如何正确地做到这一点?我不在乎它是否是笔记本中的静止图像或交互式显示。

+0

你生成了什么样的情节?对于散点图,尝试使用'scattergl'。 –

+0

现在,试图做一个密度阴谋。 –

回答

3

一个选项是下降采样数据,不知道你会喜欢的: https://github.com/devoxi/lttb-py

我也有在浏览器plotly问题与大型数据集 - 如果任何人有解决方案,请写! 谢谢!

+0

有一个公开的问题来整合LTTB支持的情节,通过它似乎不是一个优先事项:https://github.com/plotly/plotly.js/issues/560 –

+0

这是可行的只有线性数据,时间序列。如果你有其他类型的数据,它可能会给出一个非常错误的结果! – Petronella