Home > Mobile >  Matplotlib not showing quiver to [0,0,0
Matplotlib not showing quiver to [0,0,0

Time:03-30

I am trying to build a plot in 3d with matplotlib which has a dot at [0,0,0] and a quiver (vector) "looking" to it from [10, 10, 10]. But when I run the code I only get the dot. Why is that and how can I fix it? Code:

import matplotlib.pyplot as plt

fig = plt.figure()
ax = plt.axes(projection="3d")

ax.set_xlim3d(0, 20)
ax.set_ylim3d(0, 20)
ax.set_zlim3d(0, 20)

ax.quiver(10, 10, 10, 0, 0, 0, length=2)
ax.scatter(0,0,0)

plt.show()

CodePudding user response:

IIUC, you're looking for:

ax.quiver(10, 10, 10, -10, -10, -10, length=1)

Output:

enter image description here

  • Related