Julian
Julian

Reputation: 27

Quiver to [0,0,0] isn't showing

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?

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()

Upvotes: 0

Views: 226

Answers (1)

BigBen
BigBen

Reputation: 49998

IIUC, you're looking for:

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

Output:

enter image description here

Upvotes: 2

Related Questions