<Python, matplotlib> 3D描画
3D
を描いてみる。
In [1]: import pandas as pd In [2]: import numpy as np In [3]: import matplotlib.pyplot as plt In [4]: from mpl_toolkits.mplot3d import Axes3D In [5]: df = pd.DataFrame(data=np.random.randn(20,3), columns=list('xyz')) In [12]: df.head() Out[12]: x y z 0 0.805902 -0.265093 -0.764933 1 0.367553 0.410720 1.258435 2 -0.273022 0.464175 -1.609088 3 -0.710719 0.808845 1.484619 4 0.349715 0.248810 0.175916 In [17]: fig = plt.figure() ...: ax = Axes3D(fig) ...: ax.plot_trisurf(df.x, df.y, df.z, cmap='rainbow') ...: Out[17]: <mpl_toolkits.mplot3d.art3d.Poly3DCollection at 0x8151908>