For magnetic fields, the plotting procedure does not change, but the field calculation is quite different. The simplest case involves the field in the vicinity of long wires. If we stay with our equilateral array (with wires perpendicular to the plane of the triangle) and have currents of -I, +2I, and -I, no unspecified long wires are needed to complete circuits. We need to know three things about the magnetic field due to a long wire: its magnitude varies inversely with the distance from the wire, it forms a circle with the wire as center, and its direction is given by the right-hand rule. Vectors are summed in the same way as in the gravitational case. The accuracy of the plotting algorithm is demonstrated by the fact that even fieldlines that go far off scale close when they return.
For most other configurations it is necessary to integrate the Biot-Savart law over the current distribution to calculate the field. The sample program does this for a circular current loop centered in the y=0 plane, and plots fieldlines in the z=0 plane.
At distances far from a current loop, its field is identical to that of a magnetic dipole. The north/south pole concept is the magnetostatic analog of positive/negative charge in electrostatics. Magnetic poles are postulated to set up radial magnetic fields that fall off inversely as the square of distance. As is the case with charge, like poles repel and unlike poles attract. The main difference from electrostatics is that magnetic poles occur only as north-south pairs of equal magnitude (although, from time to time, there has been speculation about free magnetic poles). The next example compares the field of a current loop with the field of a pair of opposing poles on the loop axis separated by the loop diameter. The current loop is one-sixth the size of the one in the previous example, and field lines are drawn starting at a loop diameter from the center of the configuration. The field due to the current loop is plotted first in red, then the field due to the pair of poles is plotted in blue. The field lines due to the two sources are similar in shape, but certainly do not overlap. If, however, we reduce the size of the sources by a factor of ten by selecting the "Far" option, the fields are virtually indistinguishable. (The sources are not redrawn a factor of ten smaller.)