我在绘制3D图并在其上绘制轴,如何在同一轴上绘制多条线

时间:2019-06-28 16:12:57

标签: python matplotlib 3d

if __name__ == "__main__":
    from matplotlib import pyplot as plt
    from SDOF_FRF import SDOF_FRF
    from mpl_toolkits.mplot3d import Axes3D
    from numpy import linspace, sqrt, array
    color = ["g", "c", "g", "r", "b", "k", "k", "c", "g", "r"]
    zeta_vec = [0.1, 0.15, 0.2, 0.3, 0.5, 1/sqrt(2), 1, 2]
    w_vec = linspace(0, 6, 1000)
    w_n = 2
    k = 3
    f1 = plt.figure()
    for zeta in zeta_vec:
        ind = zeta_vec.index(zeta)
        H_w = SDOF_FRF(w_vec, k, w_n, zeta)
        ax = f1.add_subplot(111, projection='3d')
        ax.plot3D(w_vec/w_n, H_w.real, H_w.imag)

plt.show()

0 个答案:

没有答案