Để vẽ một điểm đơn lẻ trong không gian 3D, dùng ax.scatter() trên axes 3D với tọa độ (x, y, z).
Các bước
- Thiết lập figure size và autolayout.
- Tạo figure và axes 3D.
- Gọi ax.scatter(2, 3, 4, c='red', marker='*', s=1000).
- Hiển thị bằng show().
Ví dụ
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(2, 3, 4, c='red', marker='*', s=1000)
plt.show()
Kết quả
