# pgfplots: select number of divisions

I'm not stuck to using pgfplots to produce this, so feel free to offer suggestions.

For my exam papers, I want to provide the students with blank semi-log grids to do hand plots. (To be specific, they are making Bode diagrams).

The following definition approximates the behaviour that I want. The only problem is controlling the divisions along y:

\NewDocumentCommand\BodeGrid{mmmm}{
\pgfplotsset{width=#1, height=#2}
\begin{tikzpicture}
\begin{axis}[
xmode=log,
xmin=1e0, xmax=1e#3,
ymin=0, ymax=#4,
grid=both,
major grid style={black!50},
yticklabels={},
xticklabels={},
]
\end{axis}
\end{tikzpicture}
}

The arguments here are the width and height, then I want to specify the number of decades along x, then the number of divisions along y. The x-axis works just fine because it will automatically produce the appropriate number of decades according to the range, if I provide an integer. The y axis, however, is at the mercy of the code which automatically divides the axis. For some range of integers (for y, the 4th argument), this command actually does what I want.

For example, \BodeGrid{\textwidth}{0.75\textheight}{3}{12} produces:

Your plot is empty of actual points so pgfplots is smart enough to not to bother. If you pretend that you are actually drawing something it will cooperate.

\documentclass{standalone}
\usepackage{pgfplots}
\newcommand{\BodeGrid}[4]{\begin{tikzpicture}
\begin{axis}[width=#1, height=#2,
xmode=log,
xmin=1e0, xmax=1e#3,
ymin=0, ymax=#4,
grid=both,
major grid style={black!50},
yticklabels={},
xticklabels={},
ytick={1,...,#4}
]