代码之家  ›  专栏  ›  技术社区  ›  Drudox lebowsky

变量写入文件的matplotlib绘图进度

  •  0
  • Drudox lebowsky  · 技术社区  · 7 年前

    我需要找到一种运行python脚本的方法,该脚本绘制文件中包含的值,但绘图应该保持不变,以检查和更新绘图,因为该文件是从其他程序动态更新的。 有解决办法吗?

    1 回复  |  直到 7 年前
        1
  •  2
  •   Reckless Engineer    7 年前

    Mathieu while True

    time.sleep()

    plt.figure()  # Opens a figure you can plot in. Redundant, but more understandable
    while True:  # I suggest replacing with a halting condition/input
        #update your data object, denoted obj, from your files. 
        hold(true)
        plot('xlabel', 'ylabel', data=obj)
        time.sleep(10) # Assumes Time is imported, this will wait for 10 seconds before looping.