Memory error when ploting large array
<p>I have a problem while ploting big data on python 2.7, with spyder.</p>

<p>X, Y and Z are about 560,000 array length... wich is a lot! </p>

<pre><code># ======
## plot:

fig = plt.figure("Map 3D couleurs")
ax = fig.add_subplot(111, projection='3d')

surf = ax.plot_trisurf(Xs, Ys, Zs, cmap=cm.jet, linewidth=0)
fig.colorbar(surf)

ax.set_xlabel("X")
ax.set_ylabel("Y")
ax.set_zlabel("Z")
ax.set_title("Map 3D couleurs")

#ax.xaxis.set_major_locator(MaxNLocator(5))
#ax.yaxis.set_major_locator(MaxNLocator(6))
#ax.zaxis.set_major_locator(MaxNLocator(5))

fig.tight_layout()

plt.show();
</code></pre>

<p>Python reply this: </p>

<pre><code>Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt5.py", line 427, in idle_draw
    self.draw()
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 148, in draw
    FigureCanvasAgg.draw(self)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py", line 469, in draw
    self.figure.draw(self.renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 1085, in draw
    func(*args)
  File "C:\Python27\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 254, in draw
    for col in self.collections]
  File "C:\Python27\lib\site-packages\mpl_toolkits\mplot3d\art3d.py", line 580, in do_3d_projection
    PolyCollection.set_verts(self, segments_2d)
  File "C:\Python27\lib\site-packages\matplotlib\collections.py", line 842, in set_verts
    self._paths.append(mpath.Path(xy, codes))
MemoryError
</code></pre>

<p>Do you have an idea to solve this problem on python 2.7. 
May be an other library, function... or stop using python?!</p>

<p>Do you need the amount of detail from a length <code>560'000</code> array? If not, you could easily sub-sample the arrays, using for example:</p>

<pre><code>n = 1000   # sample every n-th data point
surf = ax.plot_trisurf(Xs[::n], Ys[::n], Zs[::n], cmap=cm.jet, linewidth=0)
</code></pre>

python python-2.7 memory matplotlib