[Tex/LaTex] Change TikZ’s default coordinate system

tikz-pgf

In the TikZ manual I read that the default coordinate system's spacing is 1cm, so that (1,1) would be a vector going 1cm in x-direction and 1cm in y. In a diagram with a lot of nodes, that I am placing using the options such as above =of ..., this spacing is too much.

In order to change that, how can I change the coordinate system's default spacing?

Best Answer

You can change the coordinate system with x=<length> and y=<length> as options to a tikzpicture, e.g.

\begin{tikzpicture}[x=0.5cm,y=0.5cm]

however in your case you would probably rather change the node distance, as this defines the distance between nodes when using the above=of syntax:

\begin{tikzpicture}[node distance=0.5cm]

or

\begin{tikzpicture}[node distance=0.5cm and 0.5cm]

The difference between these two cases is illustrated in the TikZ/PGF manual (ยง16.5.3 Advanced Placement Options, pages 187-188, for v. 2.10).

You could also set this globally, by using \tikzset, i.e. add

\tikzset{node distance=0.5cm and 0.5cm}

to your preamble.