2
\documentclass{scrartcl}

\usepackage{pgfplots}
\pgfplotsset{compat=1.15}

\begin{document}

\section*{\texttt{minor y tick num} Works}
\begin{tikzpicture}
    \begin{axis}[
    %
    axis x line = bottom,
    axis y line = left, 
    %
    grid = both,
    minor x tick num = 1,
    minor y tick num = 1,
    %
    xmin = 0,
    xmax = 10.2,
    xtick = {0,1,...,10},
    %
    ymin = 0,
    ymax = 1.05,    
    %
    ]
    \end{axis}
\end{tikzpicture}

\section*{\texttt{minor y tick num} Does Not Work}
\begin{tikzpicture}
\begin{axis}[
    % 
    axis x line = bottom,
    axis y line = left, 
    %   
    grid = both,
    minor x tick num = 1,
    minor y tick num = 1,
    %               
    xmin = 0,
    xmax = 10.2,
    xtick = {0,1,...,10},
    %   
    ymin = 0,
    ymax = 1.05,
    ytick = {0,0.2,...,1.2}, % <--- Difference
    %           
]
\end{axis}
\end{tikzpicture}

\end{document}

Problem As soon as I define ytick = {0,0.2,...,1.2}, the minor y ticks disappear. Maybe I don't see the obvious :=).

enter image description here

  • 2
    This has been asked before once as far as I can remember. The problem is that 0,0.2,...,1.2 doesn't give you exactly 0.2 between the ticks due to to numerical imprecisions, that is you might get one tick at 0.2, the next at 0.4, but the next after that at 0.599999. Minor ticks are only added if the major ticks have the same distance. Use ytick = {0,0.2,0.4,0.6,0.8,1.0,1.2}, and you get minor ticks. – Torbjørn T. Jan 24 '18 at 13:55
  • 1
    Or use ytick distance=0.2. – Torbjørn T. Jan 24 '18 at 14:03
  • @TorbjørnT. Thanks a lot. Very tricky that tick problem. – Dr. Manuel Kuehner Jan 24 '18 at 14:04

0 Answers0