13

I made a small tkzpicture as in the SWE below. How may I rotate it 90 positive degrees?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}

\begin{document}

%\pagestyle{empty}
\tikzstyle{decision} = [diamond, draw, fill=blue!20, 
    text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=gray!20, text width=7.5em, rounded corners, minimum height=4.1em]
\tikzstyle{blocks} = [rectangle, fill=white!20, text width=9em, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [ellipse,fill=white!20, node distance=2cm,
    minimum height=2em]


\begin{tikzpicture}[node distance = 2cm, auto]

    %\node [block] (initial) {Initial text};
    \node [block] (beginning) {{\tiny Beginning}};
    \node [cloud, below of =beginning] (decide) {Reactions};
    \node [block, below of=decide, node distance=3cm](stop){{\tiny \textbf{Second alternative}: Wait }};
    \node[block, left of =stop, node distance=3cm](left){{\tiny \textbf{First alternative}: Continue}};
    \node[block, right of =stop, node distance=3cm](right){{\tiny \textbf{Third alternative}: Give in }};
    \node[blocks, below of =left, node distance=2cm](node name){{\large Logo}};  
    %\path [line] (initial) -- (evaluate);
    \path [line] (beginning) -- (decide);
    \path [line] (decide) -- node {}(stop);
    \path [line](decide)--(right);
    \path [line](decide)--(left);
\end{tikzpicture}

\end{document}
16

You can use the rotate key, but you also need transform shape or nodes are not rotated:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}

\begin{document}

%\pagestyle{empty}
\tikzstyle{decision} = [diamond, draw, fill=blue!20,
    text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=gray!20, text width=7.5em, rounded corners, minimum height=4.1em]
\tikzstyle{blocks} = [rectangle, fill=white!20, text width=9em, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [ellipse,fill=white!20, node distance=2cm,
    minimum height=2em]


\begin{tikzpicture}[node distance = 2cm, auto,rotate=90,transform shape]

    %\node [block] (initial) {Initial text};
    \node [block] (beginning) {{\tiny Beginning}};
    \node [cloud, below of =beginning] (decide) {Reactions};
    \node [block, below of=decide, node distance=3cm](stop){{\tiny \textbf{Second alternative}: Wait }};
    \node[block, left of =stop, node distance=3cm](left){{\tiny \textbf{First alternative}: Continue}};
    \node[block, right of =stop, node distance=3cm](right){{\tiny \textbf{Third alternative}: Give in }};
    \node[blocks, below of =left, node distance=2cm](node name){{\large Logo}};
    %\path [line] (initial) -- (evaluate);
    \path [line] (beginning) -- (decide);
    \path [line] (decide) -- node {}(stop);
    \path [line](decide)--(right);
    \path [line](decide)--(left);
\end{tikzpicture}

\end{document}

enter image description here

| improve this answer | |
4

Funny solution: Wrapping a tikzpicture in a tikzpicture node which is rotated by 90 degrees:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}

\begin{document}

%\pagestyle{empty}
\tikzset{
  ,decision/.style=
    {
      diamond, draw, fill=blue!20, text width=4.5em, text badly centered, 
      node distance=3cm, inner sep=0pt
    }
  ,block/.style=
    {
      rectangle, draw, fill=gray!20, text width=7.5em, rounded corners, 
      minimum height=4.1em
    }
  ,blocks/.style=
    {
      rectangle, fill=white!20, text width=9em, rounded corners,
      minimum height=4em
    }
  ,line/.style={draw, -latex'}
  ,cloud/.style={ellipse,fill=white!20, node distance=2cm, minimum height=2em}
}

\begin{tikzpicture}
  \node[rotate=90] at (0,0) {
    \begin{tikzpicture}[node distance = 2cm, auto]

        %\node [block] (initial) {Initial text};
        \node [block] (beginning) {{\tiny Beginning}};
        \node [cloud, below of =beginning] (decide) {Reactions};
        \node [block, below of=decide, node distance=3cm](stop){{\tiny \textbf{Second alternative}: Wait }};
        \node[block, left of =stop, node distance=3cm](left){{\tiny \textbf{First alternative}: Continue}};
        \node[block, right of =stop, node distance=3cm](right){{\tiny \textbf{Third alternative}: Give in }};
        \node[blocks, below of =left, node distance=2cm](node name){{\large Logo}};  
        %\path [line] (initial) -- (evaluate);
        \path [line] (beginning) -- (decide);
        \path [line] (decide) -- node {}(stop);
        \path [line](decide)--(right);
        \path [line](decide)--(left);
    \end{tikzpicture}
  };
\end{tikzpicture}

\end{document}
| improve this answer | |
  • @marmot \rotatebox didn't work for me. The other tips should be implemented, give me a second :) – Skillmon Jun 28 '18 at 22:07
  • @marmot I would have posted it if it did work for me. Feel free to post your answer :) – Skillmon Jun 28 '18 at 22:10
  • You are right that it won't work in the OP's document, but of course the first thing I did was to remove the \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} stuff, and then \rotatebox{90}{...} does work. ;-) – user121799 Jun 28 '18 at 22:36
  • @marmot funny thing, as soon as anything boxes the tikzpicture the rotation doesn't work for me. And removing the preview might not be what OP wants. – Skillmon Jun 28 '18 at 22:38
  • 2
    Nesting tikzpicture is highly not recommended. – Peter Grill Jun 29 '18 at 0:16
1

With standalone document class as cropping element instead of preview package, you can include the tikzpicture inside a rotatebox command to get the desired result.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
%\usepackage[active,tightpage]{preview}
%\PreviewEnvironment{tikzpicture}

\begin{document}

%\pagestyle{empty}
\tikzstyle{decision} = [diamond, draw, fill=blue!20, 
    text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=gray!20, text width=7.5em, rounded corners, minimum height=4.1em]
\tikzstyle{blocks} = [rectangle, fill=white!20, text width=9em, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [ellipse,fill=white!20, node distance=2cm,
    minimum height=2em]


\rotatebox{90}{%
\begin{tikzpicture}[node distance = 2cm, auto]

    %\node [block] (initial) {Initial text};
    \node [block] (beginning) {{\tiny Beginning}};
    \node [cloud, below of =beginning] (decide) {Reactions};
    \node [block, below of=decide, node distance=3cm](stop){{\tiny \textbf{Second alternative}: Wait }};
    \node[block, left of =stop, node distance=3cm](left){{\tiny \textbf{First alternative}: Continue}};
    \node[block, right of =stop, node distance=3cm](right){{\tiny \textbf{Third alternative}: Give in }};
    \node[blocks, below of =left, node distance=2cm](node name){{\large Logo}};  
    %\path [line] (initial) -- (evaluate);
    \path [line] (beginning) -- (decide);
    \path [line] (decide) -- node {}(stop);
    \path [line](decide)--(right);
    \path [line](decide)--(left);
\end{tikzpicture}
}

\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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