TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

I'm trying to make a plot which has a double logarithmic y-axis. Is this possible? This should change the distance of each logarithmic increment, for I want to plot so called Bit-error rates. To have a straight line of the measured data this type of scaling is needed (y=log(log(x)). It is known that in normal log plot the distance between each increment is the same... Unfortunately I was not able to find a solution in the pgfplots-manual. The only option given there is single log for one or both axis. An example is picture is given at the link below. This is the way it should look like.

share|improve this question
log(log(x)) is valid only for x>1. – kiss my armpit Aug 27 '12 at 17:11
What you see plottet is log(x). But you need log(log(x)). I don't want to recalculate the data, I want to rescale the y-axis. See the plot at the given link... – Christian Aug 27 '12 at 17:20
Actually I didn't want to go into the details, but I think concerning your comment I have to. So what actually is linear to the x axis is the complementary error function erfc. To be precise: 10*log(Q^{-1}(BER)) with Q(BER)=0.5*erfc(BER/sqrt{2}) – Christian Aug 27 '12 at 18:00
pgfplots has no builtin solution for log(log(x)). However, it accepts x coord trafo/.code={<some custom trafo which depends on #1>}, and some inverse transformation using x coord inv trafo. You may need to customize tick positions explicitly, though. Would that help you? – Christian Feuersänger Aug 27 '12 at 21:07
I worked around by transforming y manually and using ytick={3.09023,3.71902,4.26489,4.75342,5.19934,5.612,5.99781,6.36134}, yticklabels={$10^{-3}$,$10^{-4}$,$10^{-5}$,$10^{-6}$,$10^{-7}$,$10^{-8}$,$10^{-9‌​}$,$10^{-10}$}, y dir=reverse, The recalculation is done with the inverse Q-Function: Q-1(y)=sqrt(2)erfinv(1-2y) This is the exact solution for y. log is just a good approximation. That's why people dont't use this transformation and use loglog-y-axis. I calculated the yticks with the same formula using y={10^-3,10^-4,10^-5, etc. ...} – Christian Aug 28 '12 at 8:53
up vote 4 down vote accepted

As Christian Feuersänger said, you can use a y coord trafo to transform the coordinates on the fly. The tick labels would usually be re-transformed using y coord inv trafo, but the precision of the math engine isn't high enough for this (1000 becomes 997.8), so you'll have to provide the labels explicitly:


    y coord trafo/.code=\pgfmathparse{log10(log10(#1))},
    extra y ticks={2,...,9,20,30,...,90,200,300,...,900,2000,3000,...,9000},
    extra y tick labels={},
    every extra y tick/.style={major tick length=3pt}
\addplot {exp(exp(x))};
share|improve this answer

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.