5

The normal scientific coordinate is something like 10^2, how do I change it to 1e+2 style ?

For example:

\documentclass[border=4mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
scaled ticks=false,
y tick label style={/pgf/number format/sci},
ymin=1, ymax=5000,
]
\addplot {pow(x, x)};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

It should be 1e+3, 2e+3 and so forth.

iKid
  • 227
  • 4
    Don't think this can handle variables like x in the notation (unless you mean it as a placeholder for an actual number), but it is related, nonetheless: http://tex.stackexchange.com/questions/110388/siunitx-and-engineering-e-notation – Steven B. Segletes Apr 27 '16 at 20:08
  • 1
    Whoever voted to close: If this is a duplicate, it's not of that question. This question has nothing to do with siunitx. – Torbjørn T. Apr 27 '16 at 20:25
  • @StevenB.Segletes no it's just a number, not a variable. And yes, this has nothing to do with siunitx – iKid Apr 27 '16 at 23:57

1 Answers1

9

This is actually described in the manual for pgf/TikZ. See section 92.1 Changing display styles (for v3.0.1a, dated August 29, 2015).

You're almost there in fact, just change the number formatting option for the yticklabels to /pgf/number format/.cd,sci,sci e. If you want a capital e, use sci E instead.

\documentclass[border=4mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
scaled ticks=false,
y tick label style={/pgf/number format/.cd,sci,sci e},
ymin=1, ymax=5000,
]
\addplot {pow(x, x)};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

Old answer

Is this what you were after?

\documentclass[border=4mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
log number format basis/.code 2 args={e${\pgfmathprintnumber[showpos=true]{#2}}$}
]
\addplot {exp(x)};
\end{semilogyaxis}
\end{tikzpicture}
\end{document}

enter image description here

Torbjørn T.
  • 206,688
  • Seems like what I want, but the number in front of e is wrong, for example: 1 * 10^2 becomes just e+2, is there anyway to make it like 1e+2 ? And is there anyway for it to work with normal axis instead of semilog ? – iKid Apr 27 '16 at 21:25
  • @iKid Could you add a minimal example of what you have to your question? I.e. something like the code in my answer, only showing the type of values you want to modify. (Would make the question much clearer.) – Torbjørn T. Apr 28 '16 at 04:40
  • I added the example – iKid Apr 28 '16 at 06:32
  • awesome, I'm looking for this option I don't know why I have missed it – iKid Apr 28 '16 at 15:27