quiver 3d矢量图颜色错误(箭头出现奇怪的两种颜色)

问题描述 投票:0回答:0

我正在尝试为某些向量绘制具有不同颜色的 3d 向量图。箭袋中可能有错误还是我瞎了:-)? 一些箭头出现奇怪的“双色外观”。

我可以将代码分解为以下内容:

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import pandas as pd

X = [39.954,39.932,39.91,39.914,39.915]
Y = [60.52,54.904,56.16,55.436,55.628]
Z = [39.1,42.5,42.7,43.0,43.5]
U = [5.704,7.507,9.526,8.095,6.762]
V = [13.896,-4.116,3.959,-0.627,0.22]
W = [-3.43,40.474,35.515,34.182,30.944]
Plot_Farbe = ['black', 'red', 'red', 'red', 'red']
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.quiver(X, Y, Z, U, V, W, colors = Plot_Farbe,length=0.2)
ax.set_xlim([35, 45])
ax.set_ylim([50, 65])
ax.set_zlim([35, 55])
plt.show()

我试过这个

  • Python:3.10.11
  • matplotlib: 3.7.1
  • Windows 11
  • Ubuntu

如果每个箭头都有one颜色的解决方案,我会很高兴。最后会有一个设置颜色和几百个矢量的功能。

python matplotlib vector colors 3d
© www.soinside.com 2019 - 2024. All rights reserved.