Macaulay2 » Documentation
Packages » Graphics :: svgPicture(Picture)
next | previous | forward | backward | up | index | toc

svgPicture(Picture) -- create an SVG picture from a Picture object

Synopsis

Description

The heading used is stored in defaultSVGHeading and the SVG opening bracket (resp. closing) used is stored in defaultSVGOpening (resp. defaultSVGClosing).

i1 : myfgp1 = formatGraphicPrimitives({point(20,30)},hashTable {"fill"=>"black"})

o1 = FormattedGraphicPrimitives{{Point2D{20, 30}}, HashTable{"fill" => black}}

o1 : FormattedGraphicPrimitives
i2 : myfgp2 = formatGraphicPrimitives({circle(point(20,30),10),point(50,60)},hashTable {"fill"=>"red","fill-opacity"=>"0.2"})

o2 = FormattedGraphicPrimitives{{Circle{Point2D{20, 30}, 10}, Point2D{50, 60}}, HashTable{"fill" => red        }}
                                                                                          "fill-opacity" => 0.2

o2 : FormattedGraphicPrimitives
i3 : mypict = picture {myfgp1,myfgp2}

o3 = Picture{FormattedGraphicPrimitives{{Point2D{20, 30}}, HashTable{"fill" => black}}, FormattedGraphicPrimitives{{Circle{Point2D{20, 30}, 10}, Point2D{50, 60}}, HashTable{"fill" => red        }}}
                                                                                                                                                                             "fill-opacity" => 0.2

o3 : Picture
i4 : svgPicture(mypict)

o4 = <?xml version="1.0" standalone="no"?>
     <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
     "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

     <svg width="150" height="160" version="1.1"
     xmlns="http://www.w3.org/2000/svg">

     <circle cx="20" cy="30" r="2" stroke="black" fill-opacity="1" stroke-width="0" fill="black" stroke-opacity="1" />

     <circle cx="20" cy="30" r="10" stroke="black" fill-opacity="0.2" stroke-width="1" fill="red" stroke-opacity="1" />

     <circle cx="50" cy="60" r="2" stroke="black" fill-opacity="0.2" stroke-width="0" fill="red" stroke-opacity="1" />

     </svg>

See also

Ways to use this method: