# pgfplot: use pgfmathdeclarefunction defined function within coordinate

This code snippet defines a simple function using \pgfmathdeclarefunction (e.g. f()) and \pgfmathparse. I would like to use the defined function f() within other coordinate, e.g. (0.2, f(0.2)) vs. (0.2, f(0.2). Note the latter has one fewer ). Both usage do plot the dot, but the former results pgfplots error:

error| Package pgfplots Error: Sorry, I could not read the plot coordinates near ')'

I would like to know are these usage of defined function f() correct?

\begin{tikzpicture}
\pgfmathdeclarefunction{f}{1}{%
\pgfmathparse{#1}%
}
\begin{axis}[xmin=0, xmax=1, ymin=0, ymax=1,]
% this draw the plot, but also report an error
% this works
\end{axis}
\end{tikzpicture}

-

If the function is used inside a coordinate pair, then you get two closing parentheses:

(0.2, f(0.2))


This apparently confuses the parser. These parentheses are not matched like curly braces in \TeX, when an argument is read. A set of curly braces protects the inner parentheses:

(0.2, {f(0.2)})


Then the inner delimiters are hidden for the parser that looks for the closing coordinate pair delimiter.

-