1

I have a question: How can I create arrows on axes xyz on 3D graphics?

I using pylib: matplotlib for drawing.
Moreover, I tried making a couple of arrows on graphic but I had common sticks in the result. Image:
[Graphic what I get][1]

Here is my code:

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from itertools import product, combinations

fig = plt.figure()
ax = Axes3D(fig)
ax.set_xlabel('Вісь x')
ax.set_ylabel('Вісь y')
ax.set_zlabel('Вісь z')
ax.set_aspect('auto')
ax.set_autoscale_on(True)

u = np.arange(-2, 2, 0.1)
x, y = np.meshgrid(u, u)
z = x * y
ax.plot([0, 0], [0, 0], [0, 3], color="blue",)
ax.plot([0, 3], [0, 0], [0, 0], color="green",)
ax.plot([0, 0], [0, 3], [0, 0], color="magenta",)
ax.plot_surface(x, y, z, cmap="plasma", edgecolor="red")

plt.show()

Iangyl
  • 69
  • 11
  • You mean 3D arrows like in [this example](https://stackoverflow.com/questions/11140163/plotting-a-3d-cube-a-sphere-and-a-vector-in-matplotlib)? – Mr. T Oct 16 '20 at 06:54
  • @Mr.T not what I expected but for the alternative variant it's good enough. Thanks! – Iangyl Oct 16 '20 at 10:33
  • Not sure what you want to achieve but imho `quiver` is rather comfortable to generate multiple arrows. Good luck with your project. – Mr. T Oct 16 '20 at 10:59

0 Answers0