I inverted the vertical axis in Tikz for convenience, and then tried to draw a simple grid:


    \draw[step=1] (0,0) grid (4,4);

For some reason I got all the vertical lines and one horizontal line:

enter image description here

Dropping the [y=-1cm] bit gives me the desired output:

enter image description here

Is it a bug? How can I keep the inverted vertical axis while drawing a grid?

  • Do you not get a compilation error? Can you please post a complete example? When I try to complete yours with a minimal wrapper, it does not compile at all.
    – cfr
    Commented Oct 15, 2015 at 22:27
  • 1
    Your code produces an error. What you are trying to do can be achieved with \begin{tikzpicture}[yscale=-1] \draw[step=1] (0,0) grid (4,4); \end{tikzpicture}. Commented Oct 15, 2015 at 22:29
  • I edited the question with the entire code. Have no issues with compiling it (MiKTeX, pdflatex)...
    – Daniel
    Commented Oct 15, 2015 at 22:36
  • @GonzaloMedina, your solution also works for me, thank you!
    – Daniel
    Commented Oct 15, 2015 at 22:37
  • @Zarko This looks like a bug to me. If it is not, how can we explain that replacing [y=-1cm] with [yscale=-1] works fine ?
    – Kpym
    Commented Oct 16, 2015 at 19:56

1 Answer 1


I actually managed to fix the problem by changing the vertical step to -1 and swapping the y coordinates of the grid:

    \draw[xstep=1,ystep=-1] (0,4) grid (4,0);

but to me this looks like a bug in Tikz.

  • A bug? I doubt. I thing that you request from TikZ two opposite action at the same time, and this confuse it. It cannot be posivite steps with negative value ...
    – Zarko
    Commented Oct 15, 2015 at 23:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .