TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

\begin{axis}[axis equal image,
axis lines=middle,
axis line style={-latex},
ymin=-2.5, ymax=2.5,
clip =false,
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}
  \addplot[domain=-3:3,samples=200,restrict y to domain=-2:2]{ln(\c*x)};

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

At the moment I am using:

\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$};
share|improve this question
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
up vote 8 down vote accepted

You can say

\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.

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.