3

Basically I want the labels beside the tick marks on a log axis displayed as

27,28,29,...

and not as

10^27,10^28,10^29,...

The closest I can get is by defining the number format to be only the exponent, argument #1, but it always inserts digits to the right of the decimal when displayed. I need whole integers here.

In this example I have both axes as logarithmic, but I would also like to know how to use this style for just one of the logarithmic axes, and let the other axis be 1,10,100,1000,etc.

This may have been answered before, but I've searched the manual (notably section 4.12+) and stackexchange for hours, and can't find it. I'm still learning pgf syntax, too! My example code/hack below.

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{loglogaxis}[
log base 10 number format code/.code={#1},
]
\addplot coordinates {
(5, 8e26)
(9217, 3e30)
};
\end{loglogaxis}
\end{tikzpicture}
\end{figure}
\end{document}

1 Answer 1

7

The changed line is marked:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{loglogaxis}[
%log base 10 number format code/.code={#1},
log base 10 number format code/.code={\pgfmathprintnumber[fixed]{#1}}, % PS
]
\addplot coordinates {
(5, 8e26)
(9217, 3e30)
};
\end{loglogaxis}
\end{tikzpicture}
\end{figure}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .