6

I know how to get a grid in pgfplots as shown below, but how can I get additionally a subgrid without labels?

\documentclass{article}

\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
   \begin{axis}[grid=both,no markers,samples=100]
      \addplot {sin(deg(x))};
   \end{axis}
\end{tikzpicture}

\end{document}

Output:

output

student
  • 29,003

1 Answers1

5

You can use grid=both and minor tick num=<number>; then (if you want to) you can set the length for the minor ticks to 0pt:

\documentclass{article}

\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
   \begin{axis}[
  grid=both,
  no markers,
  samples=100,
  minor tick num=2,
  every minor tick/.style={minor tick length=0pt}]
      \addplot {sin(deg(x))};
   \end{axis}
\end{tikzpicture}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128