What’s this about?

In Stata 15, graphs can be exported to scalable vector graphics (SVG) format.

All modern web browsers support SVG. Vector graphics editors such as Adobe Illustrator and Inkscape also support SVG.

SVG images are popular because they can be scaled without loss of image quality, unlike PNG and JPEG files. Thus, SVG images are popular when the same image will be displayed at different sizes and resolutions, such as on webpages or ebooks.

Stata aleady supports encapsulated PostScript (EPS)—another scalable vector graphics format—but EPS files are not suitable for use on webpages or ebooks, nor do they support transparency.

SVG images can be imported by other applications such as Microsoft Word, but the PDF format works just as well (and does support transparency).

Stata 15 exports compact SVG files by default, and optionally exports verbose SVG files that are easier to edit with a text editor.

Show me

Exporting to .svg format is easy. Draw a graph by typing

 

. sysuse uslifeexp2, clear
. twoway connected le year
. graph export uslifeexp.svg

uslifeexp

To export the image, type

 

. graph export uslifeexp.svg



(file uslifeexp.svg written in SVG format)

 

The graph we showed you on this page is in SVG format. The SVG format is XML-based, which makes it editable by a text editor. Take a look.

 

Tell me more

Learn more about Stata’s publication-quality graphics features.

See [G-2] graph exportg in the Stata Graphics Reference Manual.