69

I am using Tikz to draw a wide graph but starting from left and after reaching the middle of the graph the nodes fall outside of page. I tried playing with scale but the graph distorts and texts inside nodes does not conform to new scale well. So I need to move the (0,0) to some place left, say (-5,0) to have enough space to draw the rest of graph. How can I do that? I saw the shifting command in the manual but it was command specific and converting the coordinates is somehow overkill.

How can I shift the (0,0) to a new coordinate, say (-5,0)?

1 Answer 1

93

If you want to do exactly this, then put whatever you want to move in a scope, and provide the shift option to said scope (the curly braces are necessary so the comma isn't thought to separate options). Something like

\begin{tikzpicture}
  \begin{scope}[shift={(-5,0)}]
    ... graph goes here ...
  \end{scope}
  ... other code goes here ...
\end{tikzpicture}

However, if your whole picture is wider than the text, this won't help. In that case, you should be able to use a negative horizontal space:

\hspace*{-5cm}%
\begin{tikzpicture}
  ... picture goes here ...
\end{tikzpicture}

However, if you want centering, you could check out some of the solutions to a similar problem with over-wide tables, such as surrounding it in a zero-width box.

3
  • Is there another possibility to shift the origin than in a environment? I tried \scope[shift={(0,-5)}]. It is no surprise, that it didnt work. I want to shift it several times throughout the TikZ-picture. Feb 14, 2017 at 17:06
  • @MaestroGlanz: I don't know, off the top of my head – sounds like a great new question to ask here! Feb 14, 2017 at 17:09
  • 1
    For cross reference: here is the new question: tex.stackexchange.com/questions/353855/… Feb 14, 2017 at 18:32

You must log in to answer this question.

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