Ahoy!
I am trying to plot vectors in 3D using the matplotlib quiver function. To help visualize them, I also would like to plot orthogonal axes centered at the origin.
Ideally, I would like to move the so-called spines, but according to this SO post, there is no easy fix for that.
I ended up plotting the axes as three vectors along x, y & z (see my code below), but I can't help but think this is a terrible solution... Any input will be greatly appreciated.
Here's the code:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
f = plt.figure(1)
ax=plt.gca()
soa = np.array([[0, 0, 0, 1, 0, 0],[0, 0, 0, 0, 1, 0],[0, 0, 0, 0, 0, 1]])
X, Y, Z, U, V, W = zip(*soa)
soa2 = np.array([[0,0,0,np.sqrt(2)/2,np.sqrt(2)/2,np.sqrt(2)/2]])
I, J, K, F, G, H = zip(*soa2)
fig = plt.figure()
ax=Axes3D(fig)
ax.quiver(X, Y, Z, U, V, W, color='black')
ax.quiver(I, J, K, F, G, H)
ax.set_xlim([-1, 1])
ax.set_ylim([-1, 1])
ax.set_zlim([-1, 1])
f.show()
And here's the image returned by this script:

