# How can I use “axis cs” of pgfplots with mathematical expression?

Inside the environment axis I can specify some points with axis cs. Up to now I am only able to use specific coordinates like 1,1. But I want to know how to use a mathematical expression like ln(3),2.

Here is an example:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.4}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis equal image,
width=10cm,
axis lines=middle,
axis line style={-latex},
xtick=\empty,
ytick=\empty,
ymin=-2.5, ymax=2.5,
xmin=-3.4,xmax=3.3,
clip =false,
xlabel={$x$},ylabel={$y$},
every axis x label/.append style={anchor=north},
every axis y label/.append style={anchor=east},
]

\foreach \c in {-2,-1,-0.5,0.5,1,2}

%ln(1*3)1,098612289
\node[anchor=west] at (axis cs:3,1.099) {$c=1$};
%\node[anchor=west] at (axis cs:3,ln(3)) {$c=1$};
\end{axis}
\end{tikzpicture}
\end{document}


At the moment I am using:

%ln(1*3)1,098612289
\node[anchor=west] at (axis cs:3,1.099) {$c=1$};


but I would prefer a more automatic way

\node[anchor=west] at (axis cs:3,ln(3)) {$c=1$};

-
For a quick fix, you can use \pgfmathparse{ln(3)} \node[anchor=west] at (axis cs:3,\pgfmathresult) {$c=1$};. –  percusse Jan 29 '12 at 11:20

You can say

\pgfmathlog{3}\let\mylog\pgfmathresult
\node[anchor=west] at (axis cs:3,{\mylog}) {$c=1$};


Not exactly the same, but I guess that performing complex calculations when looking for coordinates is not easy.

-
I am sure the the internal algorithm is complex so I can live with a small "work around" ;-) –  Marco Daniel Jan 29 '12 at 11:24