# paste this code at the end of VectorFieldPlot 1.01 doc = FieldplotDocument('VFPt_imagecharge_plane_horizontal_plusminus', width=500, height=600, commons=True) field = Field({'monopoles':[[0,1.5,1], [0,-1.5,-1]]}) doc.draw_charges(field, scale=1.5) xy = lambda phi: sc.array([0,1.5]) + rot([0,1], phi) Fs = ig.quad(lambda phi: sc.dot(rot([0,1], phi), field.F(xy(phi))), 0, 2*pi)[0] n = 22 for i in range(n): a = float(i) / n phi = op.brentq(lambda phi1: ig.quad(lambda phi: sc.dot(rot([0,1], phi), field.F(xy(phi))), 0, phi1)[0] - a * Fs, 0, 2*pi) line = FieldLine(field, xy(phi), maxr=10, directions='both', bounds_func=lambda p: -p[1]) doc.draw_line(line, arrows_style={'max_arrows':1, 'offsets':[0.6,0.4,0.4,0.6]}) line = FieldLine(field, [xy(phi)[0], -xy(phi)[1]], maxr=10, directions='both', bounds_func=lambda p: p[1]) doc.draw_line(line, arrows_style=None, attributes=[['stroke-dasharray', '0.08,0.12'], ['stroke-linecap', 'butt']]) # draw the metal surface metal_surface = doc.draw_object('g', {'id':'metal_surface'}) defs = doc.draw_object('defs', {}, group=metal_surface) grad = doc.draw_object('linearGradient', {'id':'metal_grad', 'x1':0, 'x2':0, 'y1':0, 'y2':1, 'gradientUnits':'objectBoundingBox'}, group=defs) for of, op in ((0, 0), (1, 1)): doc.draw_object('stop', {'offset':of, 'stop-color':'#bbb', 'stop-opacity':op}, group=grad) doc.draw_object('rect', {'x':-2.5, 'y':-0.8, 'width':5, 'height':0.8, 'style':'fill:url(#metal_grad); stroke:none'}, group=metal_surface) doc.draw_object('path', {'d':'M -2.5,0 H 2.5', 'style':'fill:none; stroke:#000; stroke-width:0.04'}, group=metal_surface) doc.write()