Skip to content
/ pgfplots to SVG

pgfplots to SVG

pgfplots draws publication-quality plots. Paste your axis: it is compiled in your browser and becomes an SVG that is sharp at every size, or a PNG for Word and slides. An example plot is loaded to try.

Examples:
Preamble (optional)

Your commands and TikZ libraries. Already loaded: tikz, amsmath, amssymb; pgfplots, tkz-tab and tikz-cd are added automatically when used, as are Otoolia's shortcuts (\R, \conj{A}, \proba…).

or Ctrl + Enter

Preview

The preview will appear here.

Fix a figure you already published

Paste the whole content of the “Custom HTML” block here (the TikZ code is kept as a comment at the start of the block):

Using the figure in WordPress

  • Paste the HTML block (recommended): add a “Custom HTML” block and paste the copied block. No image to upload, no plugin. The TikZ code is kept in the block as a comment, invisible to visitors: to fix a typo, paste the block back into “Fix a figure you already published”. You need an administrator account (WordPress strips SVG code pasted by other roles).
  • Upload the .svg file: WordPress refuses SVG by default; install the “Safe SVG” plugin, then insert the file with an “Image” block.

The figure adapts to the screen width, stays crisp at any zoom, and several figures can share a page. It also works on any website or in an HTML file.

Frequently asked questions

Is my code sent to a server?

No. The TeX engine (TikZJax, TeX compiled to WebAssembly) runs in your browser. It weighs about 7 MB, downloaded once on the first generation; your browser keeps it afterwards.

Which packages can I use?

TikZ and all its libraries (\usetikzlibrary{…} in the preamble), pgfplots, tkz-tab, tikz-cd, tikz-3dplot, amsmath, amssymb, array. For other packages (circuitikz, chemfig, tkz-euclide, venndiagram…), the Compile with the full engine button uses the TeX Live 2026 of Otoolia's LaTeX editor, still in your browser: you get a vector PDF and PNG images (no SVG).

Why is the SVG 40 to 80 KB?

The LaTeX fonts used by the figure are embedded in the file, so it displays identically everywhere without loading anything else. Once compressed by the web server, it is about half that size.

The figure does not compile: what now?

The tool points out the most common mistakes (unclosed braces or parentheses, missing semicolon, environment not closed). Custom commands must be defined in the preamble. To build a complex figure, Otoolia's LaTeX assistant generates trees, variation tables and plots without errors.

Engine: TikZJax (David Grice, after Jim Fowler), GPL-3.0 licence; tkz-tab package by Alain Matthes.

How to do it

  1. Paste your axis environment inside a tikzpicture (the example shows the form).
  2. Generate: compat=1.18 is set automatically.
  3. Copy the HTML block for a website, or download the SVG or PNG.
  4. For many points, reduce samples if compilation is slow.

Tips

Frequently asked questions

Which pgfplots libraries are available?

pgfplots and its usual options; for rare libraries (groupplots, fillbetween…), try the full engine.

The graph is too big or too small?

Set width=… in the axis options, or the export size (× 1.3, × 1.5, × 2).

Is my code sent to a server?

No: the TeX engine (TikZJax, in WebAssembly) runs in your browser; it is downloaded once (about 7 MB) and then kept.