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

This page announced the new features in Stata 15. Please see our Stata 18 page for the new features in Stata 18.

Export Stata graphs in SVG format

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.

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)

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