SVG (.svg, .sgvz)

MIME type: image/svg+xml
SVG vector graphics format.
Intended for two-dimensional vector graphics on the web.
Partially supported by several web browsers and browser plug-ins.
SVG is an acronym for Scalable Vector Graphics.
XML-based text format.
Can represent static and animated graphics.
Supports RGB color with an optional alpha channel.
Developed by the W3C SVG Working Group since 1998.
  • Export supports SVG versions 1.0 and 1.1.
  • Mathematica exports static SVG graphics.

Import and ExportImport and Export

  • Export["file.svg", expr] exports text or vector graphics to SVG.
  • Export["file.svg", expr, elem] creates an SVG file by treating expr as specifying element elem.
  • The export format can be explicitly specified with the command Export["file", expr, "SVG"].
  • See the reference pages for full general information on Export.
  • ExportString supports the SVG format.

ElementsElements

  • Data representation element:
  • "Graphics"arbitrary 2D graphics
  • Export uses the element by default.

ExamplesExamplesopen allclose all

Basic Examples (4)Basic Examples (4)

Export vector graphics to SVG:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

This converts formatted text to the SVG format:

In[1]:=
Click for copyable input
Out[1]=

Export a function plot to SVG:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Show SVG data created by Mathematica:

In[1]:=
Click for copyable input
Out[1]=
New in 5 | Last modified in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »