0

How can I draw a grid of help lines like \draw [help lines] (0,0) grid (3,2); but use other base vectors (not (1,0) and (0,1)) instead?

E.g. choosing (1,1) and (1,0) should ideally give me a grid something like this enter image description here

  • 2
    Would this help ? http://tex.stackexchange.com/questions/42557/drawing-lattice-trellis-graphs-using-pgf-tikz – percusse Nov 09 '16 at 13:08
  • Oh, using coordinate transformation seems to be a good approach! I just started using TikZ so I did not know it was that powerful... – Simon Fromme Nov 09 '16 at 13:21
  • One detail is that you don't need a low level command for transformations, I was probably thingkin too complicated. cm key does the same (you can read about it on the manual) – percusse Nov 09 '16 at 13:37

1 Answers1

1

You can use the xslant=<factor> where <factor> is, of course, a number which in degrees will be the inverse cotangent of <factor>:

\documentclass[tikz, border=2mm]{standalone}

\begin{document}
  \begin{tikzpicture}
  \begin{scope}
    \clip (0,0) rectangle (3,2);
    \draw [help lines,xslant=1] (-5,-5) grid (5,5);
  \end{scope}
    \draw (0,0) -- (45:1);
  \end{tikzpicture}
\end{document}

enter image description here