I want to draw a particular path in a triangular grid using tikz LaTeX like in the picture below. How can I do that?


  • 4
    Hi and welcome. Is it the grid that you have a problem with, or is it the drawing of arrows on a grid? Do you already have a code for the grid? – AndréC Jul 31 at 21:32

Here is a way to achieve what you want by defining the triangles in loops. It is possible to increase the size of the drawing by just modifying the dimensions and adding steps in the loops.



        \draw[thick] (-2.5, -{sqrt(3)/2}) rectangle (2.5, {sqrt(3)});
        \path[clip] (-2.5, -{sqrt(3)/2}) rectangle (2.5, {sqrt(3)});
        \foreach \x in {-1,0,1}{
            \foreach \y in {-3.5,-2.5,...,2.5}{
                \draw ({\y - 0.5*Mod(\x+1,2)},{\x*sqrt(3)/2}) -- ++ (60:1) -- ++ (-60:1) -- cycle;

        \coordinate (next) at (-2, 0);
        \foreach \x in {1,2,...,4}{
            \draw[-Latex,blue] (next) -- ++ (60:1) coordinate (next);
            \draw[-Latex,blue] (next) -- ++ (-60:1) coordinate (next);

which yields:

enter image description here

| improve this answer | |
  • Thank you KersouMan – Rajkarov Aug 1 at 10:15

To build the arrows, I created a new coordinate system in which the x-axis is horizontal and the y-axis is the side of the 60° angle. It is called triangular and its alias is tri.




\begin{tikzpicture}[x=0.75cm, y=0.75cm,>=Latex]

% the grid
\foreach \j in {0,...,1} {
  \foreach \i in {0,...,5} {
\draw(current bounding box.north west)rectangle(current bounding box.south east);

% the arrows
\draw [thick,blue,->](tri cs:x=0,y=0)--node[below]{x}(tri cs:x=3,y=0);
\draw [thick,blue,->](tri cs:x=0,y=0)--node[left]{y}(tri cs:x=0,y=3);

\draw [thick,violet,->] (tri cs:x=1,y=1)--(tri cs:x=1,y=2);
\draw [thick,violet,->] (tri cs:x=1,y=2)--(tri cs:x=2,y=1);
\draw [thick,violet,->] (tri cs:x=2,y=1)--(tri cs:x=2,y=2);
\draw [thick,violet,->] (tri cs:x=2,y=2)--(tri cs:x=3,y=1);

| improve this answer | |
  • Thank you AndréC – Rajkarov Aug 1 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.