I have a plot where I would like to add the fit parameters in the legend box, as shown in the attached JPG file. Having some trouble with line breaks and tables in the legend. Any other possibilities available with TikZ/PGF?
Thanks in advance
attached: JPG file, data file (*.txt)
Code: Select all
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\pgfplotsset{compat=newest}
\usetikzlibrary{positioning}
\usepackage[bitstream-charter]{mathdesign}
\begin{document}
\begin{tikzpicture}
\begin{axis} [
width=12cm, %the width of the box
height=8cm, %the height of the box
%grid =major,
%grid style={dashed},
% thick,
xlabel= Distance \lbrack $ mm $\rbrack ,
%xtick = {3,5,...,31},
xmax=30,
xmin=10,
%ylabel= Intensity \lbrack arb. units \rbrack, % \lbrack a.u.\rbrack,x
yticklabels= , %supress the ylabe numbering
%ymax=9,
ymin=0,
mark = none,
legend style = {legend pos=north east,font=\tiny, draw=none}
]
\pgfplotstableread{beam-profile-fit.txt}
\teff
\addplot [color = blue, mark=none, smooth, each nth point=2] table[y=fit] from \teff;
\addlegendentry{Gauss fit $y = y_0 + (A/(w\sqrt{\pi/2}))e^{-2 \frac{x-xc}{w}^2 }$ $y_0 = s$};
\end{axis}
\end{tikzpicture}
\end{document}