如何用matplotlib绘制二维数学向量?有人有关于这方面的例子或建议吗?
我有两个向量存储为2D numpy阵列,我想把它们绘制成有向边。
拟绘制的向量如下:
import numpy as np
# a list contains 3 vectors;
# each list is constructed as the tail and the head of the vector
a = np.array([[0, 0, 3, 2], [0, 0, 1, 1], [0, 0, 9, 9]])
编辑:
我刚刚为对输出感兴趣的人添加了tcaswell最终答案的图,并希望用matplot
我尝试使用如下指针修改BGRA垫子:
//Bound the value between 0 to 255
uchar boundPixelValue(double c) {
c = int(c);
if (c > 255)
c = 255;
if (c < 0)
c = 0;
return (uchar) c;
}
for (int i = 0; i < rows; i++)
for (int j = 0; j < cols; j++)
for (int k =