推荐学习书目
› 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 · Mar 18, 2021 · 2682 views
    This topic created in 2022 days ago, the information mentioned may be changed or developed.

    我尝试在里面添加大量的 箭头, 大概总数据为 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 replies  •  2021-03-18 21:12:41 +08:00
    ch2
        1
    ch2  
       Mar 18, 2021
    曾经有个同学问我为什么 Linux 不允许他同时创建 10W 个进程
    somewheve
        2
    somewheve  
    OP
       Mar 18, 2021
    @ch2 他这里一个一个绘画的吗 ? 有没有办法可以一次性先载入啊
    somewheve
        3
    somewheve  
    OP
       Mar 18, 2021
    matplotlib 绘图 一次性读取会快很多 难整 但是我不想用
    somewheve
        4
    somewheve  
    OP
       Mar 18, 2021
    搞定了用 ScatterPlotItem
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   929 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 23:06 · PVG 07:06 · LAX 16:06 · JFK 19:06
    ♥ Do have faith in what you're doing.