# Tikz grid with inverted vertical axis

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

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[y=-1cm]
\draw[step=1] (0,0) grid (4,4);
\end{tikzpicture}
\end{document}


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

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

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 Oct 15 '15 at 22:27
• 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}. – Gonzalo Medina Oct 15 '15 at 22:29
• I edited the question with the entire code. Have no issues with compiling it (MiKTeX, pdflatex)... – Daniel Oct 15 '15 at 22:36
• @GonzaloMedina, your solution also works for me, thank you! – Daniel Oct 15 '15 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 Oct 16 '15 at 19:56

I actually managed to fix the problem by changing the vertical step to -1 and swapping the y coordinates of the grid:
\begin{tikzpicture}[y=-1cm]

but to me this looks like a bug in Tikz.