# Reverse coordinate system/axis in TikZ

Consider the following image:

When creating a Tikz picture, the X and Y positions origin and continue as the picture A represents it. But what if I wanted it to work like picture B?

I could use the negative values for the Y, but if I wanted it to be positive instead (so if the number increases, the represented point goes down)... Would that be possible?

In other words, can I set the origin to be in the Top-left side of a page?

This is very easily accommodated by using the cs system of TikZ. You can even define your own coordinate systems (say you want a triangular mesh, you can actually do that).

But for linear scaling of the axis you can do:

\begin{tikzpicture}[y=-1cm]
\draw (0,0) -- (1,0) node[below] {$x$};
\draw (0,0) -- (0,1) node[left] {$y$};
\end{tikzpicture}


As opposed to:

\begin{tikzpicture}%
\draw (0,0) -- (1,0) node[below] {$x$};
\draw (0,0) -- (0,1) node[left] {$y$};
\end{tikzpicture}


Remark that you can also apply this in scopes:

\begin{tikzpicture}
\draw (0,0) -- (1,0) node[below] {$x$};
\draw (0,0) -- (0,1) node[left] {$y$};
\begin{scope}[y=-1cm,xshift=2cm] % Notice that we shift the entire scope
\draw (0,0) -- (1,0) node[below] {$x$};
\draw (0,0) -- (0,1) node[left] {$y$};
\end{scope}
\end{tikzpicture}


The last one will produce:

# Page reference

For accessing relative placement on the page, please see: Positioning relative to page in TikZ

You can also use yscale=-1 as an option to either tikzpicture or a scope:

\documentclass{article}
\usepackage{tikz}
\begin{document}
Inside a \verb|scope|:

\begin{tikzpicture}
\draw (0,0) -- (1,0) node[below] {$x$};
\draw (0,0) -- (0,1) node[left] {$y$};
\begin{scope}[yscale=-1,xshift=2cm] % Notice that we shift the entire scope
\draw (0,0) -- (1,0) node[below] {$x$};
\draw (0,0) -- (0,1) node[left] {$y$};
\end{scope}
\end{tikzpicture}

\vspace{2cm}
Inside  \verb|tikzpicture|:

\begin{tikzpicture}[yscale=-1]
\draw (0,0) -- (1,0) node[below] {$x$};
\draw (0,0) -- (0,1) node[left] {$y$};
\end{tikzpicture}

\end{document}


In addition to zertoth’s answer: It’s even posiblie to change the basis vector an not only it’s length with y={(x,y)} like

\begin{tikzpicture}[y={(-0.5cm,-1cm)}]
\draw (0,0) -- (1,0) node[below] {$x$};
\draw (0,0) -- (0,1) node[left] {$y$};
\end{tikzpicture}


• Good point. Maybe i should've elaborated more on that. I have actually previously used a triangular mesh to ease the build-up of a pyramid. – zeroth Jan 9 '13 at 12:40