Help us understand the problem. What is going on with this article?

matplotlibを用いたリアルタイムプロット

More than 1 year has passed since last update.

matplotlibは重すぎてアニメーションプロットに向いていない気がする。

以下の記事を参考に2変数をappendしていくlistをplotする例を書いた。
https://qiita.com/hausen6/items/b1b54f7325745ae43e47

subplotを使うのとplt.pauseが味噌。

pos = []
lines = []
while 1:
 # get some newdata=[x,y]
 pos.append(newdata)

 if not lines:
  fig, ax = plt.subplots(1,1)
  lines, = ax.plot([i[0] for i in pos],[i[1] for i in pos])
  ax.set_xlim((-1.5,1.5))
  ax.set_ylim((-1.5,1.5))
 else:
  lines.set_data([i[0] for i in pos],[i[1] for i in pos])

 plt.pause(0.001)
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away