# 3D Vector Field Doesn't have Arrows

I have been trying to plot 3D vector fields, but I keep running into a problem. The graphic does not have arrows instead it is just lines. Here is the code.

var('x,y,z')
p = plot_vector_field3d((x,y,z), (x, -5, 5), (y, -5, 5), (z, -5, 5))
p.show()

edit retag close merge delete

Sort by » oldest newest most voted

Until #24623 is ready, the minimal code to plot the proposed vector field within the manifold framework is (this works with Sage >= 7.5):

R3 = Manifold(3, 'R^3')
X.<x,y,z> = R3.chart()
v = R3.vector_field()
v[:] = (x,y,z)
p = v.plot(max_range=5, scale=0.5)
p.show()


It is a little bit slow, but thanks to some optimisations, this should be improved in future versions of Sage. See the online doc for the list of all options of v.plot(). Note also that you can replace the last line by p.show(viewer='threejs').

more

Once #24623 is merged in Sage, the above code will reduce to

E.<x,y,z> = EuclideanSpace(3)
v = E.vector_field((x,y,z))
v.plot(max_range=5, scale=0.5)


The SageManifolds implementation of vector fields gives you a rendering with arrows.

See the gallery at

There is ongoing work to make the SageManifolds approach the default for vector fields in Sage, see

more