You seem to do some plots with
TikZ/PGF. The
pgfplots package not only makes plotting easier but also offers a nice feature that simply works with the known mechanism of
\label
and
\ref
. An example derived from Section 4.8.6 of the package manual.
Code: Select all
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}
\pgfplotsset{
compat=newest,
xlabel near ticks,
ylabel near ticks
}
\begin{document}
\begin{figure}[!htb]
\centering
\begin{tikzpicture}[baseline]
\begin{axis}
\addplot+[
only marks,
samples=15,
error bars/y dir=both,error bars/y fixed=2.5
] {3*x+2.5*rand};
\label{pgfplots:label1}
\addplot+[mark=none] {3*x};
\label{pgfplots:label2}
\addplot {4*cos(deg(x))};
\label{pgfplots:label3}
\end{axis}
\end{tikzpicture}
\caption{The estimations \protect\ref{pgfplots:label1} which are subjected to noise. It appears the model \protect\ref{pgfplots:label2} fits the data appropriately. Finally, \protect\ref{pgfplots:label3} is only here to get three examples.}
\label{fig:pgfplots-labels}
\end{figure}
\end{document}
All
\ref
commands need to be prefixed by
\protect
in order to avoid problems with
\listoffigures
(see above code). The output is attached.
Thorsten