Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

the y-axis of my diagram uses small numbers like 0,005. I don't want to use a multiplier like 10^-3 which appears by default. If I remove it with

scaled x ticks = false, x tick label style={/pgf/number format/fixed},

the tick labels are not accurate enough and show ony 0 or 0,1:

enter image description here

Code used:

\begin{tikzpicture}
\begin{axis}[%
scaled x ticks = false,
x tick label style={/pgf/number format/fixed},
scaled y ticks = false,
scale only axis,
width=6cm,
height=5cm,
xmin=0, xmax=30000,
ymin=-0.001, ymax=0.006,
ymajorgrids,
axis on top]

How can i get this right?

share|improve this question
    
By indenting code with four spaces you get a code block, as I did in my edit. When pasting in code, you can select the entire block and hit Ctrl + K (or click the {} button above the text field) to get everything indented. Also, it's always best to provide a complete, compilable, yet minimal example, a minimal working example (MWE). –  Torbjørn T. Nov 23 '11 at 15:23
add comment

1 Answer

up vote 8 down vote accepted

Try adding

yticklabel style={/pgf/number format/fixed,
                  /pgf/number format/precision=3}

as an option to the axis.

enter image description here

Left, with /pgf/number format/precision=3, right without. Complete code:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
   scaled x ticks = false,
   x tick label style={/pgf/number format/fixed},
   scaled y ticks = false,
   yticklabel style={/pgf/number format/fixed,
                     /pgf/number format/precision=3},
   scale only axis,
   width=6cm,
   height=5cm,
   ymajorgrids,
   axis on top]
      \addplot coordinates {(0,0) (0.2,0.01)};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[%
   scaled x ticks = false,
   x tick label style={/pgf/number format/fixed},
   scaled y ticks = false,
   yticklabel style={/pgf/number format/fixed},
   scale only axis,
   width=6cm,
   height=5cm,
   ymajorgrids,
   axis on top]
     \addplot coordinates {(0,0) (0.2,0.01)};
\end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer
    
perfekt thank you :) –  Chris Nov 23 '11 at 16:09
1  
@Chris You're welcome. You can accept my answer (and thereby marking the question as "solved", as well as giving out some points), by clicking the checkmark to the left of the answer. –  Torbjørn T. Nov 23 '11 at 16:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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