from mpl_toolkits.mplot3d.axes3d import get_test_data

X, Y, Z = get_test_data(0.5)

print(f"X.shape={X.shape}")
print(f"Y.shape={Y.shape}")
print(f"Z.shape={Z.shape}")

 

출력 결과

X.shape=(12, 12)
Y.shape=(12, 12)
Z.shape=(12, 12)

 

 

import matplotlib.pyplot as plt

fig, axs = plt.subplots(ncols=3, figsize=(10, 4), subplot_kw={"projection":"3d"}, constrained_layout=True)

for ax, d in zip(axs, [1, 0.5, 0.1]):
    X, Y, Z = get_test_data(d)
    dim = X.shape[0]
    ax.plot_wireframe(X, Y, Z)
    ax.set_title(f"get_test_data({d}): {dim}x{dim}", fontsize="x-large", color="gray", fontweight="bold")

 

 

 

 

 

 

 

 

 

 

 

 

 

참고

 

https://matplotlib.org/stable/plot_types/3D/wire3d_simple.html#sphx-glr-plot-types-3d-wire3d-simple-py

 

plot_wireframe(X, Y, Z) — Matplotlib 3.8.2 documentation

plot_wireframe(X, Y, Z) See plot_wireframe. import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d plt.style.use('_mpl-gallery') # Make data X, Y, Z = axes3d.get_test_data(0.05) # Plot fig, ax = plt.subplots(subplot_kw={"projection": "3d"}

matplotlib.org

 

https://jehyunlee.github.io/2021/07/09/Python-DS-79-mpl3d/

 

Matplotlib 3D Plots (1)

Matplotlib으로 3D Plot을 할 수 있습니다. 많은 분들이 알고 있는 사실이지만 적극적으로 쓰이지 않습니다. 막상 쓰려면 너무 낯설기도 하고 잘 모르기도 하기 때문입니다. Reference matplotlib tutorial: The

jehyunlee.github.io

 

'Data > Visualization' 카테고리의 다른 글

[Matplotlib] plot  (0) 2023.12.17

+ Recent posts