V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
somewheve
V2EX  ›  Python

Python 使用 pyqtgraph 绘制大量文本标记 速度问题

  •  
  •   somewheve · 2021-03-18 19:56:06 +08:00 · 1411 次点击
    这是一个创建于 1128 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我尝试在里面添加大量的 箭头, 大概总数据为 4w+ 其中 up 的有 4000+ down 的有 3000+, 然后渲染起来就非常慢 。。。。

        def set_history_arrow(self):
            print(f"===> up: {len(self.up)} down: {len(self.down)}")
            for up in self.up:
                print("up", self.up.index(up))
                up_arrow = pg.TextItem('↑', fill=(255, 0, 0))
                self.plot_widget.addItem(up_arrow)
                up_arrow.setPos(up, self.data[up])
            for down in self.down:
                print("down", self.down.index(down))
                down_arrow = pg.TextItem("↓", fill=(0, 238, 118))
                self.plot_widget.addItem(down_arrow)
                down_arrow.setPos(down, self.data[down])
            print("图形生成完毕")
    

    https://stackoverflow.com/questions/66690425/how-to-improve-the-speed-of-drawing-a-lot-of-textitem-in-pyqtgraph

    大佬们有啥办法解决吗

    4 条回复    2021-03-18 21:12:41 +08:00
    ch2
        1
    ch2  
       2021-03-18 20:44:58 +08:00
    曾经有个同学问我为什么 Linux 不允许他同时创建 10W 个进程
    somewheve
        2
    somewheve  
    OP
       2021-03-18 20:48:27 +08:00
    @ch2 他这里一个一个绘画的吗 ? 有没有办法可以一次性先载入啊
    somewheve
        3
    somewheve  
    OP
       2021-03-18 20:54:39 +08:00
    matplotlib 绘图 一次性读取会快很多 难整 但是我不想用
    somewheve
        4
    somewheve  
    OP
       2021-03-18 21:12:41 +08:00
    搞定了用 ScatterPlotItem
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2719 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:53 · PVG 22:53 · LAX 07:53 · JFK 10:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.