I have a problem with plotting using pgfplots. What I want is a spectrum as attached in file. But my code I don't get what I want.
I guess the problem lies within the axis definition; but I couldn't find enough information online. I would appreciate it if someone can point me to the right direction.
Code: Select all
\documentclass{article}
\usepackage{pgfplots}
%\usepackage{tikz}
%-----------------------------defining my own coordinate system---
\pgfplotsset{
mystyle/.style={%
smooth,
width=10cm,
ylabel={Intensity [a.u.] (log)},
xlabel={Order of High Harmonics},
xmin=0,xmax=31,
xtick={1,3,5,...,31}
}
}
\begin{document}
\pgfmathdeclarefunction{gauss}{2}{%
\pgfmathparse{1*exp(-((x-#1)^2)/(2*#2^2))}%
%\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
}
\begin{tikzpicture}
\begin{axis}[mystyle]
\addplot {gauss(3,0.09)};
\addplot {gauss(5,0.09)};
\addplot {gauss(7,0.09)};
\addplot {gauss(9,0.09)};
\addplot {gauss(11,0.09)};
\addplot {gauss(13,0.09)};
\addplot {gauss(15,0.09)};
\addplot {gauss(17,0.09)};
\addplot {gauss(19,0.09)};
\end{axis}
\end{tikzpicture}
\end{document}
Fawad