3

How can I get a 10 base multiplier at every tick? I only get 1 multiplier that has a strange position

scaled y ticks={base 10:-3}

I can't recreate it right now, however by default I got the lowest numbers scaled, the rest was normal decimal numbers. I would like to keep it consistent throughout the complete axis. Either no scaling at all (which looks bad if the numbers are small enough) or scaling all the way.

scale ticks below exponent={-2}

Does not work if the ticks values from the axis differ too much (then only 1 axis is scaled properly). Thanks in advance! Still learning.

5

Since the MWE was not available, I took the liberty to study you recent post your example, follow your concern, and this is what this attempt has done for a possible solution to your question.

When scale ticks={base 10:-3} key is used, the base 10:-3 will divide every tick label by 10^-3, resulting in a common factor 10^3 for y axis and causing problems on number formatting. A quick fix is to remove the fixed style in the style.

I use your example to demonstrate the idea.

enter image description here

Code:

\documentclass[]{article}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[%
width=\textwidth-\widthof{100},
height=8cm,
xmin=0,
xmax=0.04,
xlabel={[S]=$\frac{\texttt{mol}}{\texttt{L}}$},
xmajorgrids, scaled x ticks = false,
x tick label style={
/pgf/number format/.cd,
fixed,
precision=3,
    /tikz/.cd
},
ymin=0,
ymax=0.23,
ylabel={[V]%\textsubscript{0}]=$\frac{\texttt{mol}}{\texttt{L} \cdot \texttt{s}}$
},
ymajorgrids,scaled y ticks={base 10:-3},
%/pgf/number format/sci subscript, % alternative expression (method 2)
y tick label style={    
/pgf/number format/.cd,
%fixed,                            % mark out this style    (method 1)
precision=2,
    /tikz/.cd
},
legend style={at={(0,1)},anchor=north west}
]
\addplot [
%color=mycolor1,
mark size=2pt,
only marks,
mark=diamond*,
mark options={solid,}%fill=mycolor1}
]
table[row sep=crcr]{
0.001198562 0.0344717664736108 \\
0.002394254 0.0365895792303057 \\
0.003984064 0.0563386501133353 \\
0.011857708 0.111166458313178 \\
0.019607843 0.164120742512085 \\
0.031007752 0.220381981506325 \\
0.038461538 0.22523224268105 \\
};
%\addlegendentry{};
\end{axis}
\end{tikzpicture}

\end{document}
  • Your input didn't do the trick. I played further around and came to this solution: scale ticks below exponent={-3}, %fixed, for x and y precision=1, for x and y Maybe you see now what I meant. Also in your plot the label is within the axis label. Anyway thank you for your help, since your input to comment fixed out lead to my solution! If you have any other input on how I can achieve that differently / easier I'm willing to learn! – idkfa Jan 14 '14 at 22:09
  • @idkfa -- I see what you meant for x coordinates. IMHO, that is why you need different precision for x and y values when needed. Given the x data in this case, setting precision=0,1 does not make sense. – Jesse Jan 14 '14 at 23:24
  • I just set the precision in a manner that forces the 10 base notation. E.g. using precision=1 for 0.01 to force 1 * 10^-2 instead of using precision=2 to keep 0.01. Did I get you right? – idkfa Jan 14 '14 at 23:33
  • OK, if you still need fixed for number format, then adjust the precision according to your data. If you mark out the fixed for x-axis, base 10 notation comes out. If the layout is jammed with digits then use sci subscript (method 2). – Jesse Jan 14 '14 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.