Attach an arrow
You can attach an arrow to a moving object. The following statement will automatically display a green arrow at the current location of the ball. The arrow will have shaftwidth=0.3, and its axis and length is determined by scale*ball.axis:
attach_arrow(ball, "axis", scale=1e3,
shaftwidth=0.3, color=color.green)
The default value of scale is 1, and the default color of the arrow is the color of the ball. You can specify any vector attribute of the moving object, not just "axis". For example, if you continually update a vector quantity ball.velocity and want to continually display an arrow representing this quantity at the location of the moving ball (with scale=1 and the color of the ball), just say this:
attach_arrow(ball, "velocity")
b = attach_arrow(ball)
...
b.stop()
...
b.start()