Graphics, Figures & TablesFit Parameters in Legend of Plot

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
thinkpadT
Posts: 25
Joined: Wed Sep 26, 2012 5:46 pm

Fit Parameters in Legend of Plot

Post by thinkpadT »

Hi everyone,

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}

Attachments
fit-parameters-gauss.jpg
fit-parameters-gauss.jpg (46.27 KiB) Viewed 5221 times
beam-profile-fit.txt
(1.75 KiB) Downloaded 396 times
Last edited by localghost on Mon Apr 15, 2013 7:26 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Fit Parameters in Legend of Plot

Post by localghost »

You can simply draw nodes inside the plot using the axis coordinate system (axis cs). Such nodes can contain almost everything, thus also a table as you know it done with a {tabular} environment. The axis coordinate system is explained in the pgfplots manual.


Thorsten
thinkpadT
Posts: 25
Joined: Wed Sep 26, 2012 5:46 pm

Re: Fit Parameters in Legend of Plot

Post by thinkpadT »

hi,

i really couldnt figure it out how to place a small 2x2 tabular inside a plot :(

please help :cry:
Post Reply