這些是我的配置,使用matplotlib來繪制數字
。importmatplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax_tl = fig.add_subplot(211, projection='3d')
ax_br = fig.add_subplot(221, projection='3d')
ax_Y0 = fig.add_subplot(212, projection='3d')
ax_Y1 = fig.add_subplot(222, projection='3d')
我嘗試了許多不同的fig.add_plot()第一個引數的組合,并從這個檔案中獲得了靈感。
我目前正在考慮將它們分開繪制,如果不值得這么麻煩的話。
。那么問題來了,我如何在Python中繪制一個2 x 2的三維散點子圖,使它們均勻地分布在圖中?我目前的代碼使得這些圖被擠壓在一起
uj5u.com熱心網友回復:
這應該能達到你的要求:
這應該能做到。
importmatplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
spec = gridspec.GridSpec(ncols=2, nrows=2, figure=fig)
ax_tl = fig.add_subplot(spec[0, 0], projection='3d'/span>)
ax_br = fig.add_subplot(spec[0, 1], projection='3d')
ax_Y0 = fig.add_subplot(spec[1, 0], projection='3d'/span>)
ax_Y1 = fig.add_subplot(spec[1, 1], projection='3d'/span>)
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/312387.html
標籤:
