# paste this code at the end of VectorFieldPlot 3.1
doc = FieldplotDocument('VFPt_Earths_Magnetic_Field_Confusion',
commons=True, width=320, height=300, unit=15)
phi = radians(-70.0)
r = 1.0
Lhalf = 2.0
field = Field([ 'coil', {'x':0, 'y':0, 'phi':phi, 'R':r, 'Lhalf':Lhalf, 'I':1}] ])
n = 11
for i in range(n):
a = -1.0 + 2.0 * (i + 0.5) / n
line = FieldLine(field, sin(phi)*a*r, -cos(phi)*a*r], directions='both', maxr=30)
doc.draw_line(line, linewidth=2, arrows_style={'scale':1.2, 'at_potentials':[0],
'potential':lambda xy: (vabs(xy) - 8.0) * rot(xy, -phi)[0],
'condition_func':lambda xy: (fabs(rot(xy, -phi)[0]) > Lhalf) or
(fabs(rot(xy, -phi)[1]) > r)})
doc.draw_object('circle', {'r':'6', 'cx':'0', 'cy':'0',
'style':'fill:#add8e6; stroke:#0000ff; stroke-width:0.066667'},
bg=True)
doc.draw_magnets(field)
doc.write()