- #1
karush
Gold Member
MHB
- 3,269
- 5
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\newcommand\gauss[2]{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))} % Gauss function, parameters mu and sigma
\begin{tikzpicture}
\begin{axis}[every axis plot post/.append style={
mark=none,domain=-2:3,samples=50,smooth}, % All plots: from -2:2, 50 samples, smooth, no marks
axis x line*=bottom, % no box around the plot, only x and y axis
axis y line*=left, % the * suppresses the arrow tips
enlargelimits=upper] % extend the axes a bit to the right and top
\addplot {\gauss{0}{0.5}};
\addplot {\gauss{1}{0.75}};
\end{axis}
\end{tikzpicture}
\end{document}
\usepackage{pgfplots}
\begin{document}
\newcommand\gauss[2]{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))} % Gauss function, parameters mu and sigma
\begin{tikzpicture}
\begin{axis}[every axis plot post/.append style={
mark=none,domain=-2:3,samples=50,smooth}, % All plots: from -2:2, 50 samples, smooth, no marks
axis x line*=bottom, % no box around the plot, only x and y axis
axis y line*=left, % the * suppresses the arrow tips
enlargelimits=upper] % extend the axes a bit to the right and top
\addplot {\gauss{0}{0.5}};
\addplot {\gauss{1}{0.75}};
\end{axis}
\end{tikzpicture}
\end{document}
ok I don't think MHB will process a newcommand but I don't know how to put this in the after \begin{tikzpicture} line
the problem with posting pic here is eventually they get remove and OP is useless...
this tikz code renders in overleaf but I also have many newcommands in preamble