skip to Main Content

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.

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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)
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search