はじめに
matplotli mplot3dでquiverを用いて、3Dグラフ上にベクトルを表示する例を解説する。
コード

解説
モジュールのインポート
データの生成
ここでx, y, zはベクトルの生える場所を意味する。
ベクトルの生成
u, v, wはベクトルとなっている。いずれのポイントも(0.1, 0.1, 0.1)の方向にベクトルができることを意味する。
ベクトルの表示
xax.quiver(x, y, z, u, v, w)でx, y, zからu, v, wの方向にベクトルを描写できる。
回転させると以下のようになる。
データを変化させたときのベクトルグラフの変化

ベクトルが下を向いていることがわかる。回転させると以下のようになる。
3Dグラフの回転は以下の記事を参考にした。

[matplotlib 3D] 14. 3Dグラフの回転アニメーション
matplotlib mplot3d のグラフの回転アニメーション
ベクトルを点線にする

ベクトルのアニメーション表示
下記記事で2Dグラフのベクトルのアニメーションについて解説しました。

[matplotlib animation] 92. quiverのアニメーション
ベクトルを表示できるquiverを使ったアニメーションをmatplotlibのFuncAnimationによって作成する。
参考
3D quiver plot — Matplotlib 3.1.0 documentation
matplotlib.pyplot.quiver — Matplotlib 3.1.0 documentation
コメント