matlab ghm,matlab – 用Python中的matplotlib绘制许多数据点

我最近从MATLAB切换到

Python进行数据分析,我使用matplotlib来显示数据.如果我想要显示的数据点数量很少,这可以正常工作.但是,如果我想想象,例如

import matplotlib.pyplot as plt

signal = [round(random.random() * 100) for i in xrange(0, 1000000)]

plt.plot(signal)

plt.show()

我收到一个错误:

Exception in Tkinter callback

Traceback (most recent call last):

File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1489, in __call__

return self.func(*args)

File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 276, in resize

self.show()

File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 348, in draw

FigureCanvasAgg.draw(self)

File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line 451, in draw

self.figure.draw(self.renderer)

File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper

draw(artist, renderer, *args, **kwargs)

File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1034, in draw

func(*args)

File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper

draw(artist, renderer, *args, **kwargs)

File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 2086, in draw

a.draw(renderer)

File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper

draw(artist, renderer, *args, **kwargs)

File "/usr/lib/pymodules/python2.7/matplotlib/lines.py", line 562, in draw

drawFunc(renderer, gc, tpath, affine.frozen())

File "/usr/lib/pymodules/python2.7/matplotlib/lines.py", line 938, in _draw_lines

self._lineFunc(renderer, gc, path, trans)

File "/usr/lib/pymodules/python2.7/matplotlib/lines.py", line 978, in _draw_solid

renderer.draw_path(gc, path, trans)

File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line 145, in draw_path

self._renderer.draw_path(gc, path, transform, rgbFace)

OverflowError: Allocated too many blocks

你能告诉我你在这种情况下会做些什么吗?您是否正在对数据进行抽样?

如果我在MATLAB中执行相同的绘图,即使有更多的数据点,我也没有遇到过这个问题.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值