在 mplot3d 中,每个 3d 箭袋箭头显示多种颜色

问题描述

我想使用 Axes3D.quiver() 在 mplot3d 中绘制多个箭袋箭头。但是,我在每个箭袋箭头中都有多种颜色。 here 指出了类似的问题。

请在下面找到代码和图证据-

import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
%matplotlib notebook
x = [1,0]
y = [0,1,0]
z = [0,1]

ax = plt.figure().add_subplot(projection='3d')

# Sending RGB colour sequence
ax.quiver(0,x,y,z,colors=[(1,0),(0,1)])
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.set_xlim(-2,2)
ax.set_ylim(-2,2)
ax.set_zlim(-2,2)
plt.savefig('Question12RGBColours')
plt.cla()

# Sending string colour sequence
ax.quiver(0,colors=['r','g','b'])
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.set_xlim(-2,2)
plt.savefig('Question12StringColours')

鉴于 quiver 的文档说任何额外的关键字参数都委托给 LineCollection,因此将两种颜色序列作为参数依次传递。结果是

RGB

Strings

那么有什么方法可以消除这种情况并在 3d 中实现不同颜色的箭袋箭头。请注意 2d quiver plot 没有显示这个问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...