I have a particular question on how to properly modify the style of tick labels, to get them in exponential style. What I actually want to have is them to be of the style 10^n at the ticks corresponding to values to be multiples of 10.
standard logarithmic axes
At the standard setting of logarithmic style axes, tikz just starts to begin to use the exponential style numbers at the labels from 10^5 upwards. smaller numbers are printed as simple numbers.
using the number format option sci 10e of pgf
When I do this (i.e. uncomment the first line within the y-axis options), tikz will print all tick labels in the format 1*10^n, which already comes close to what I want to have. But I want to get rid of the leading factor '1*' for a more compact representation.
using the number format option sci generic of pgf
Actually according to the manual of pgfplotstable this should be the option of choice, to get where I want to reach. But when I do so (i.e. uncomment the second line within the y-axis options) I get some weird result of the tick label format.
I was able to get to the point, where I wanted to reach (i.e. uncomment line three) by messing around a bit with some pgfmathparse, but I find this not to be a very good solution.
Has somebody an idea, how to solve this problem a little bit smarter?
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{datavisualization,datavisualization.formats.functions}
\begin{document}
\makeatletter
\begin{tikzpicture}
\datavisualization [
scientific axes,
all axes={length=6cm},
x axis={
ticks and grid={
step=2,
minor steps between steps=1
},
include value={0,20},
},
%
y axis={
logarithmic,
ticks and grid={
step=1,
minor steps between steps=8,
%tick typesetter/.code={\pgfkeys{/pgf/number format/.cd, sci, sci 10e}\pgfmathprintnumber{##1}},
%tick typesetter/.code={\pgfkeys{/pgf/number format/.cd, sci, sci generic={exponent={10^{##1}}}}\pgfmathprintnumber{##1}}
%tick typesetter/.code={\pgfkeys{/pgf/number format/.cd, sci, sci generic={exponent={0^{\pgfmathparse{int(round(log10(##1)))}\pgfmathresult}}}}\pgfmathprintnumber{##1}}
},
},
visualize as line
]
data[separator=\space] {
x y
0 1E1
5 1E2
10 1E3
15 1E4
20 1E5
}
;
\end{tikzpicture}
\end{document}
All lines commented out
Uncommented 1nd line
tick typesetter/.code={\pgfkeys{/pgf/number format/.cd, sci, sci 10e}\pgfmathprintnumber{##1}},
Uncommented 2nd line
tick typesetter/.code={\pgfkeys{/pgf/number format/.cd, sci, sci generic={exponent={10^{##1}}}}\pgfmathprintnumber{##1}}
Uncommented 3nd line
tick typesetter/.code={\pgfkeys{/pgf/number format/.cd, sci, sci generic={exponent={0^{\pgfmathparse{int(round(log10(##1)))}\pgfmathresult}}}}\pgfmathprintnumber{##1}}
\makeatletter
in your document? I can't see any reason for it but, if you do need it, you should issue\makeatother
when you are done needing it.