logo

How to Draw Vector Fields in Julia 📂Julia

How to Draw Vector Fields in Julia

Code

quiver(, quiver=)

In Julia, the quiver() function can be used to visualize a vector field.

θ = 0:0.2:2π
quiver(cos.(θ),sin.(θ), quiver = (-sin.(θ), cos.(θ)), size = (600,600), lims = (-2,2)); png("1")

1.png

Changing the Length of Arrows

There might be a better way to change the size of the arrows, but essentially, you can draw a better picture by increasing or decreasing the length of vectors provided by the quiver= option.

quiver(cos.(θ),sin.(θ), quiver = (-sin.(θ), cos.(θ)) ./ 2, size = (600,600), lims = (-2,2)); png("2")

2.png

Environment

  • OS: Windows
  • julia: v1.9.0