91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2KB
    文件類型: .py
    金幣: 2
    下載: 2 次
    發布日期: 2021-08-08
  • 語言: Python
  • 標簽: Python??

資源簡介

實時顯示數據對于數據采集,分析系統都是非常必要的。Python作為一種非常常用的語言,能夠在各種不同平臺上方便的使用。 在這個例子中,我使用簡單的基礎函數實現數據的實時顯示。

資源截圖

代碼片段和文件信息

#!/usr/bin/env?python3

import?matplotlib.pyplot?as?plt
import?numpy?as?np

#?use?ggplot?style?for?more?sophisticated?visuals
plt.style.use(‘ggplot‘)

def?live_plotter(x_vecy_vec_dataline_realtimeidentifier=‘‘pause_time=0.1):
????if?line_realtime==[]:
????????#?this?is?the?call?to?matplotlib?that?allows?dynamic?plotting
????????plt.ion()
????????fig?=?plt.figure(figsize=(136))
????????ax?=?fig.add_subplot(111)
????????#?create?a?variable?for?the?line?so?we?can?later?update?it
????????line_realtime?=?ax.plot(x_vecy_vec_data‘-o‘alpha=0.8)????????
????????#update?plot?label/title
????????plt.ylabel(‘Y?Label‘)
????????plt.title(‘title:?{}‘.format(identifier))
????????plt.show()
????
????#?after?the?figure?axis?and?line?are?created?we?only?need?to?update?the?y-data
????line_realtime.set_xdata(x_vec)
????line_realtime.set_ydata(y_vec_data)
????#?line_realtime.set_data(x_vecy

評論

共有 條評論