Magnets on a sheet of graph paper
The simulation lays one or two bar magnets on squared paper, with a small plotting compass beside them. Each magnet is painted red at its N pole and blue at its S pole. You can drag anything on the paper with a finger or a mouse, or choose an item under Position and use its sliders. Flip swaps a magnet's two ends, Turn rotates it a quarter of a circle, and Add puts a second magnet on the paper.
What the field lines mean
The lines with arrows are magnetic field lines. Each arrow shows the way a free north pole would be pushed if it were placed there, so outside the magnet every line runs from the N pole round to the S pole. Look at how the lines are spaced. They pack tightly around each pole, where the field is strongest, and fan out as they travel away. Two lines never meet or cross, because at any single point the field can only have one direction.
Turn on Strength colours for a second view of the same idea. The warm colours glow brightest at the poles and fade into cool purple a few centimetres away.
Plotting a field line the lab way
In a school lab you map a field by moving a compass in small steps, marking where the needle points each time. The Plot button copies this method. It marks a small arrow where the N end of the needle reaches, then slides the compass forward so that the other end of the needle sits on that mark. Press it repeatedly and a trail of arrows grows across the paper. Switch the field lines off first and your trail becomes the only record of the field. Iron filings, which you can sprinkle with the Filings button, reveal the whole shape at once but give no direction.
Two magnets together
When two magnets share the paper, their fields add together at every point. Put two N poles face to face and the magnets push apart: the arrows on the stage say repel. Between them is a neutral point, marked with a pulsing cross, where the two fields are equal and opposite. Flip one magnet so that an N pole faces an S pole and the lines stretch across the gap, joining the magnets, while the arrows now say attract. Neutral points can still appear further out, where the far ends of the magnets cancel the near ones.
The Earth's field
The Earth acts like a giant, weak magnet, which is why a lone compass points north. Switching on the Earth's field adds a uniform field of about 19 microtesla pointing up the page, a rough value for the horizontal part of the field in the UK. Close to the magnet its own field wins. Further away the Earth takes over, and neutral points appear where the two fields cancel exactly.
Inside the model
Each magnet is treated as two small opposite poles, set in from its ends by one twelfth of its length. The field is calculated in the flat plane of the paper, and the lines are drawn only outside the magnets, as course diagrams show them. Real field lines carry on through the magnet from S back to N, forming closed loops. The force arrows come from the same pole model. They show which way each magnet is pushed or pulled, but their length is not a measure of the force.