László
László

Reputation: 4144

Exporting graphs in SVG format

Stata can export graphs into various formats, including eps, pdf, wmf and emf.

To be HTML5-compliant, I would make svg graphs out of any of this, but results with online conversion tools or Photoshop do not display well.

How can I produce svg output from within Stata?

A little R or Python script is alright, but the main workflow is tied to Stata.

Note that I am using a Mac, but colleagues also use Windows.

Upvotes: 0

Views: 1127

Answers (2)

user8682794
user8682794

Reputation:

Recent versions of Stata (14+) support exporting graphs in scalable vector graphics format natively:

. sysuse auto, clear
(1978 Automobile Data)

. twoway scatter price mpg

. graph export auto.svg
(file auto.svg written in SVG format)

Upvotes: 1

BeingQuisitive
BeingQuisitive

Reputation: 158

For a cross-platform solution I have had good luck with exporting to eps format first and then using Inkscape to convert to svg. You can do this on the command-line:

inkscape -f graph.eps --export-plain-svg=graph.svg

The svg files are sometimes, but not always, smaller than their eps counter-parts. If you find some files that Inkscape does not convert well, you can see more options for this part here.

Upvotes: 0

Related Questions