Home  /  Products  /  Features  /  Export Stata graphs in SVG format

<-  See Stata's other features

Highlights

  • Stata graphs can be exported to scalable vector graphics (SVG) format

  • SVG is used on webpages and in EPUB ebook documents

  • SVG is a modern alternative to EPS

  • Compatible with all major modern web browsers, including mobile browsers

  • Supports transparency

  • Specify width and height of image

  • Editable with vector graphics applications and text editors

  • Support for compact and verbose SVG

  • Options for rendering as closely to what Stata displays (albeit at possible expense of compatibility)

In Stata, 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 also 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 exports compact SVG files by default and optionally exports verbose SVG files that are easier to edit with a text editor.

Let's see it work

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

. sysuse uslifeexp2, clear
. twoway connected le year

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 export in the Graphics Reference Manual.