我在处理三个变量的第三维图时遇到问题 .

我有三个矩阵:X,Y和Z,参数类型如下:

(x_1,y_1,z_1)

(x_2,y_2,z_2)

.

(x_n,y_n,z_n)

我可以通过scatter3D绘图在不同的点上显示它们 . 打击是我的代码,目标[0]是x,目标[1]是y,目标[2]表示z:

from mpl_toolkits import mplot3d
  import matplotlib.pyplot as plt

  fig = plt.figure()
  ax = plt.axes(projection='3d')

  ax.scatter3D([s.objectives[0] for s in algorithm.result],
        [s.objectives[1] for s in algorithm.result],
        [s.objectives[2] for s in algorithm.result])

  ax.set_xlabel('X')
  ax.set_ylabel('Y')
  ax.set_zlabel('Z')

但是,我的问题是当我想在点之间显示一条线 . 我希望在一个矩阵中改变方向的点之间有一条线,例如x .

我的意思是,如果我的目标是基于x并且假设x不断增加,我想在具有x_1的点和具有x_2的点之间有一条线,然后在具有x_2的点与具有x_3和的点之间 . ...

实际上这一行显示了当x改变时我的三个参数是如何变化的(当x增加时) .

要做到这一点,我使用plot3D,打击是我的代码:

ax.plot3D([s.objectives[0] for s in algorithm.result],
        [s.objectives[1] for s in algorithm.result],
        [s.objectives[2] for s in algorithm.result])

但是在图中我在每个点与所有其他点之间有一条线 . 我的意思是((n * n-1)/ 2)行而不是n-1行 .

如何用mplot3d实现我的目标?或其他方式 .