Vertical help lines only in TikZ

You can use ystep to fix the number of horizontal lines. For example, if you use ystep=10 with a 10 X 10 grid:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
  \draw [help lines, dashed,ystep=10] (0,0) grid(10,10);
\end{tikzpicture}

\end{document}

you get

enter image description here

And there is always brute force:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
  \foreach \x in {0,...,9}{
  \draw [help lines, dashed] (\x,0) -- (\x,10);
  }
\end{tikzpicture}

\end{document}

enter image description here


Since version 3.1 of TikZ you can use ystep=0 (or negative) to skip the vertical lines. And same for the horizontal lines with xstep=0.

\documentclass[tikz,border=7pt]{standalone}
\begin{document}
  \begin{tikzpicture}
    \draw[help lines, dashed] (0,0) grid[ystep=0] (10,10);
  \end{tikzpicture}
\end{document}

enter image description here

Tags:

Tikz Pgf