# Rotating entire document by 90 degrees

The following code looks as in the picture below:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[block/.style={rounded corners, minimum width=3cm, minimum height=2cm, draw}]

\node[block] (1) {This message stretches the box out quite a lot.};
\node[block, above right=-.5 and 2 of 1] (3) {3};
\node[block, above right=-.5 and 2 of 3] (5) {5};
\node[block, below=of 5] (6) {6};
\node[block, below left=-.5 and 2 of 6] (4) {4};
\node[block, below left=-.5 and 2 of 4] (2) {2};
\node[block, below=of 6] (7) {7};
\begin{scope}[->, shorten >=1mm, shorten <=1mm]
\draw (1) to[out=0,in=180] (3);
\draw (3) to[out=0,in=180] (5);
\draw (3) -- (4);
\draw (2) to[out=0,in=180] (4);
\draw (4) to[out=0,in=180] ([yshift=5mm]5.south west);
\draw (2) to[out=-30,in=230] (6);
\draw (6) -- (7);
\draw (5) to[out=0,in=0] (7);
\end{scope}
\end{tikzpicture}
\end{document} (Thank you Ignasi for that code.)

I have two questions:

• How can I flip the whole thing by 90 degrees? I would instead like the arrows to flow downward.
• How can I split the message into two rows so it doesn't stretch the first block so much? I tried adding \ but that didn't do anything.
• second question: add text width=... in node 1 options. – Ignasi Jul 7 '16 at 17:32
• You can add \\ to node text if you add align=center to the definition of the block style. (Or do what @Ignasi says which will also work without needing an explicit line break). To rearrange the nodes you will need to play with the positioning parameters. – Alan Munn Jul 7 '16 at 17:33
• First question: If you mean that you prefer a portrait layout for this figure, I suppose you could try to understand howpositioning library is working and try to distribute nodes according your new taste. This is different form flip the whole thing by 90 degrees. – Ignasi Jul 7 '16 at 17:36

Here is a solution

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\rotatebox{270}{%
\begin{tikzpicture}[block/.style={rounded corners, minimum width=3cm, minimum height=2cm, draw}]
\node[block, text width=3cm] (1) {This message stretches the box out quite a lot.};
\node[block, above right=-.5 and 2 of 1] (3) {3};
\node[block, above right=-.5 and 2 of 3] (5) {5};
\node[block, below=of 5] (6) {6};
\node[block, below left=-.5 and 2 of 6] (4) {4};
\node[block, below left=-.5 and 2 of 4] (2) {2};
\node[block, below=of 6] (7) {7};
\begin{scope}[->, shorten >=1mm, shorten <=1mm]
\draw (1) to[out=0,in=180] (3);
\draw (3) to[out=0,in=180] (5);
\draw (3) -- (4);
\draw (2) to[out=0,in=180] (4);
\draw (4) to[out=0,in=180] ([yshift=5mm]5.south west);
\draw (2) to[out=-30,in=230] (6);
\draw (6) -- (7);
\draw (5) to[out=0,in=0] (7);
\end{scope}
\end{tikzpicture}}
\end{document}


2nd solution

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{rotating}
\usetikzlibrary{positioning}

\begin{document}
\begin{turn}{270}
\begin{tikzpicture}[block/.style={rounded corners, minimum width=3cm, minimum height=2cm, draw}]
\node[block, text width=3cm] (1) {This message stretches the box out quite a lot.};
\node[block, above right=-.5 and 2 of 1] (3) {3};
\node[block, above right=-.5 and 2 of 3] (5) {5};
\node[block, below=of 5] (6) {6};
\node[block, below left=-.5 and 2 of 6] (4) {4};
\node[block, below left=-.5 and 2 of 4] (2) {2};
\node[block, below=of 6] (7) {7};
\begin{scope}[->, shorten >=1mm, shorten <=1mm]
\draw (1) to[out=0,in=180] (3);
\draw (3) to[out=0,in=180] (5);
\draw (3) -- (4);
\draw (2) to[out=0,in=180] (4);
\draw (4) to[out=0,in=180] ([yshift=5mm]5.south west);
\draw (2) to[out=-30,in=230] (6);
\draw (6) -- (7);
\draw (5) to[out=0,in=0] (7);
\end{scope}
\end{tikzpicture}
\end{turn}
\end{document}

• Awesome, thanks a lot @touhami ! Is there a way to make the text horizontal? As it stands, it is rotated which is not what I had in mind originally. Sorry for being unclear. – iwriteonbananas Jul 8 '16 at 16:01
• @iwriteonbananas for numerical nodes (from 2 to 7) you can do this by replacing for example \node[block, above right=-.5 and 2 of 1] (3) {3}; with \node[block, above right=-.5 and 2 of 1, label={[xshift=.2cm, yshift=-1cm, rotate=90]:3}] (3) {}; for node (1) I am sorry I don't know an easy way. – touhami Jul 8 '16 at 17:41