2

See code below: xtick={-0.8,0,...,3.2} does not show minor x ticks, but, for example, xtick={0,0.5,...,3.5} does.

I'm confused, what's going on?

\documentclass[border=0pt]{standalone}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[
      smooth,
      axis lines=middle,
      axis line style = {very thick},
      xmin=-0.8,
      xmax=3.2,
      ymin=-1.5,
      ymax=1.5,
      xtick={-0.8,0,...,3.2}, %minor tick DO NOT show
      % xtick = {-0.8,0,0.8,1.6,2.4,3.2}, %minor do tick show          
      % xtick = {0,1,...,3}, %minor tick do show
      % xtick = {0,0.5,...,3.5}, %minor do tick show
      minor tick num=1,
      grid=both,
      ]
    \addplot+[samples=100]{cos(deg(x))};
  \end{axis}
\end{tikzpicture}

\end{document}

enter image description here

0 Answers0