require 'xrvg' render = SVGRender[ :filename, "foreach.svg", :background, "white" ] Circle[].samples(10).foreach do |p1,p2| render.add( Circle[:center, p1, :radius, 0.1], Style[ :fill, Color.red ] ) render.add( Circle[:center, p2, :radius, 0.2], Style[ :fill, Color.blue ] ) render.add( Line[ :exts, [p1,p2] ] ) end render.end