4

Graphic

The following MWE shows a figure with all identical axis markers (because the scale is too narrow). The option xtick has not "high enough precision".

enter image description here

MWE Code

I did not find a suiting example in the pgfplots package manual - maybe I did not read/think long enough... I am not sure what option should be entered in the axis environment.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
\begin{axis}[every minor tick]
\addplot coordinates{(0.999,2e-2) (1.001,12) };
\end{axis}
\end{tikzpicture}

\end{document}

Similar (but different) questions

strpeter
  • 5,215
  • 4
    I think this could help you, http://tex.stackexchange.com/questions/96347/pgfplots-number-format-on-axis. – Umz Jan 09 '14 at 01:31

1 Answers1

5

Based on Umz's comment, the following code solves the problem.

\documentclass[margin=2mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
\begin{axis}[every minor tick,
  x tick label style={
    /pgf/number format/.cd,
    fixed,
    fixed zerofill,
    precision=4
  }]
\addplot coordinates{(0.999,2e-2) (1.001,12) };
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here