Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Consider the following image:

enter image description here

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?

share|improve this question
add comment

3 Answers

up vote 12 down vote accepted

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: enter image description here

Page reference

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

share|improve this answer
    
Thanks, this worked! :D –  Alenanno Jan 9 '13 at 13:34
add comment

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}

TikZ with changed basis vector

share|improve this answer
    
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
add comment

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}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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