Goal
Generate SVG file for TikZ graphics.
Method
- TeX → PDF with PDFLaTeX
- PDF → SVG with
dvisvgm -P filename
Example: I generated a PGF plot from the source code on my personal template.
Problem
When I applied this method to the following TeX code in my previous post,
dvisvgm -P
returns a blank SVG.
\documentclass[tikz,border=2pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.6}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=center,legend style={at={(0.7,0.7)},anchor=south west}]
\addplot [domain=-3:3, thick, smooth, yellow] { 1/sqrt(2*pi)*exp(-x^2/2) };
\addlegendentry{$y = \frac{1}{\sqrt{2\pi}} e^{-x^2/2}$};
\addplot [dashed, yellow] coordinates {(1.5,0) (1.5,0.14)};
\addlegendentry{99th percentile};
\addplot[domain=-3:1.5, pattern=north east lines,draw=none, fill opacity=0.3]
{ 1/sqrt(2*pi)*exp(-x^2/2) } \closedcycle;
\end{axis}
\end{tikzpicture}
\end{document}
This code passes the compiler.
[Read More]