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?
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?
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, …
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{
log number format basis/.code 2 args={{%
$
\ifdim#2pt=0.0pt\relax
1
\else\ifdim#2pt=1.0pt\relax
#1
\else
#1^{\pgfmathprintnumber{#2}}
\fi
\fi
$%
}},
}
\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[domain=0:10]
\addplot {exp(x)};
\end{semilogyaxis}
\end{tikzpicture}
\end{document}

/pgf/number format/std does not work: this needs fixing. Bug report done : https://sourceforge.net/tracker/?func=detail&aid=3602079&group_id=142562&atid=752792.
– cjorssen
Jan 25 '13 at 08:44
:)
– Qrrbrbirlbel
Mar 21 '13 at 01:39
ytickten={0,...,4}, yticklabels={1, 10, $10^2$, $10^3$, $10^4$}– Jake Jan 17 '13 at 15:05