Tracing a magnetic field

A compass will align with the lines of force around a magnet. How could you do this in 3 dimensions?

License: CC BY-NC-SA by Khan Academy