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

I would like to have y tick labels like 1, 10, 10^2, 10^3, ...

So far I found found to display them either 1, 10, 100, 1000, ... or with exponents.

Is this possible with pgfplots?

share|improve this question
It's probably most practical to do it by hand: ytickten={0,...,4}, yticklabels={1, 10, $10^2$, $10^3$, $10^4$} – Jake Jan 17 '13 at 15:05
Welcome to TeX.sx! There are a number of options in this direction described in section 4.12 of the pgfplots manual. – Andrew Swann Jan 17 '13 at 15:11
Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. – Claudio Fiandrino Jan 17 '13 at 15:12
up vote 6 down vote accepted

Yeah, /pgf/number format/std does not work.

For log axes the normal \pgfmathprintnumber macro is not used. Instead, by default $<base>^{\pgfmathprintnumber{<exponent>}}$ is used. (See pgfplots manual, section 4.12.2 “PGFPlots-specific Number Formatting”, pp. 227f.)

The code below overwrites this code key stored in log number format basis with a few conditionals. There are certainly different ways to build this conditional.

If we would want to use \ifcase for the exponent (#2) we should \pgfmathtruncatemacro it first, but for these three cases, this suffices.

Note that for negative exponents the <base>^<exponent> is used again: 10–1, 10–2, …


    log number format basis/.code 2 args={{%
    \addplot {exp(x)};


enter image description here

share|improve this answer
/pgf/number format/std does not work: this needs fixing. Bug report done : sourceforge.net/tracker/…. – cjorssen Jan 25 '13 at 8:44
Thanks a lot, this solved my problems! – user24520 Mar 20 '13 at 22:38
@user24520 You’re welcome. You can thank me more by accepting the answer. :) – Qrrbrbirlbel Mar 21 '13 at 1:39

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.