はじめに
3次元の構造化されてないデータの塗りつぶし等高線を表示するtricontourfについて解説する。
コード

解説
モジュールのインポート
バージョン
データの生成
np.random.uniform(-2, 2, npts)により-2以上,2未満のデータをnpts(200)個生成する。
3D Tricontourグラフの作成
ax.tricontour(x, y, z)で構造化されていないデータを近似して、等高線を表示できる。
ax.tricontourfでも同様に、構造化されていないデータの塗りつぶし等高線が表示できる。
ax.plot(x, y, z, ‘ko’, ms=3)でデータを黒丸で示している。
fig.colorbar(cntr1, ax=ax)でカラーバーを表示した。
回転アニメーション
参考
Triangular 3D filled contour plot — Matplotlib 3.10.0 documentation
matplotlib.axes.Axes.tricontourf — Matplotlib 3.10.0 documentation
コメント