Python matplotlib上的渐变色线

Python matplotlib上的渐变色线,python,matplotlib,3d,Python,Matplotlib,3d,我正在用python中的matplotlib绘制3D数据。这些数据模拟了布朗运动,其上的每个点都是Z 我想在图线上得到一个渐变色,例如,z的最大值是红色,最小值是蓝色,渐变介于两者之间 我使用的matplot代码是: fig_b = plt.figure() ax_b = plt.axes(projection="3d") ax_b.set_xlabel('X Axes') ax_b.set_ylabel('Y Axes') ax_b.set_zlabel('Z Axes'

我正在用python中的matplotlib绘制3D数据。这些数据模拟了布朗运动,其上的每个点都是Z

我想在图线上得到一个渐变色,例如,z的最大值是红色,最小值是蓝色,渐变介于两者之间

我使用的matplot代码是:

fig_b = plt.figure()
ax_b = plt.axes(projection="3d")

ax_b.set_xlabel('X Axes')
ax_b.set_ylabel('Y Axes')
ax_b.set_zlabel('Z Axes')

ax_b.plot3D(df_brow.x_i, df_brow.y_i, df_brow.z_i)

plt.show()
我得到:

多谢各位