6

I'm trying to illustrate some inputs (a time-series) going into a model. The arrow is meant to be centred below the dots. I'm using positioning to get the relative positions right. If I rotate the arrow, it becomes shifted. How do I rotate but "re-centre" the arrow? Thanks in advance!

Below is a MWE.

illustration

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

\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.pathreplacing,angles,quotes}
\usetikzlibrary{shapes.geometric,shapes.arrows}
\usetikzlibrary{shadows}

\begin{document}

\tikzset{%
    input_circle/.style={%
        draw,
        circle,
        minimum size=1.3cm,
        fill=yellow,
        font=\small
    },
    solid_box/.style={%
        draw,
        thick,
        centered
    },
    cascaded/.style={%
        solid_box,
        double copy shadow={
            shadow xshift=-1ex,
            shadow yshift=1ex
        }
    },
    big_arrow/.style={%
        single arrow,
        draw,
        fill=gray
    }
}
\begin{tikzpicture}

    \node (r_t_k) at (0,0) [input_circle] {$r_{t-k}$};
    \node (r_t_k_1) [input_circle,right=0.5cm of r_t_k] {$r_{t-k+1}$};
    \node (dots) [minimum size=2cm,right=0.5cm of r_t_k_1] {\huge $\cdots$};
    \node (r_t_1) [input_circle,right=0.5cm of dots] {$r_{t-1}$};
    \node (r_t) [input_circle,right=0.5cm of r_t_1] {$r_t$};

    \node (arrow1) [big_arrow,rotate=-90,below=0.2cm of dots.south] {a};

    % lstm
    \node (lstm) [cascaded, minimum width=6cm, minimum height=1.5cm, fill=orange, below=1cm of arrow1] {\Large LSTM};

\end{tikzpicture}

\end{document}
1
  • Short answer because the MWE is long: [shape border rotate=90] is the official option that is defined to rotate only the border and is in the manual.
    – Symbol 1
    Feb 7, 2022 at 8:11

2 Answers 2

10

Try to rotate only shape border:

\node (arrow1) [big_arrow,shape border rotate=270, below=0.2cm of dots.south] {a};

Considering this code line in your MWE gives:

enter image description here

Edit: Complete, slightly shortened your MWE, can be:

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles,
                chains,
                decorations.pathreplacing,
                positioning,
                quotes,
                shadows, shapes.arrows, shapes.geometric,}

\begin{document}

\tikzset{%
    input_circle/.style={%
        draw,
        circle,
        minimum size=1.3cm,
        fill=yellow,
        font=\small
    },
    cascaded/.style args={#1/#2/#3}{%
        draw,
        thick,
        fill=#3,
        minimum width=#1,
        minimum height=#2,
        double copy shadow={
            shadow xshift=-1ex,
            shadow yshift=1ex
        }
    },
    big_arrow/.style={
        single arrow,
        draw,
        fill=gray,
        minimum height=2em,
    }
}
    \begin{tikzpicture}[node distance = 8mm and 5mm]
\node (r_t_k)   [input_circle]                      {$r_{t-k}$};
\node (r_t_k_1) [input_circle,right=of r_t_k]       {$r_{t-k+1}$};
\node (dots)    [minimum size=2cm,right=of r_t_k_1] {\huge $\cdots$};
\node (r_t_1)   [input_circle,right=of dots]        {$r_{t-1}$};
\node (r_t)     [input_circle,right=of r_t_1]       {$r_t$};

\node (arrow1)  [big_arrow, shape border rotate=270, below=of dots.center] {a};

\node (lstm)    [cascaded=6cm/1.5cm/orange, below=of arrow1] {\Large LSTM};
    \end{tikzpicture}
\end{document}

Addedndum: another posibilities is that you like to have rotated contents of arrow to. IN this case you can use rotate around option:

\begin{document}
% preamble
    \begin{tikzpicture}[node distance = 6mm and 5mm]
\node (r_t_k)   [input_circle]                      {$r_{t-k}$};
\node (r_t_k_1) [input_circle,right=of r_t_k]       {$r_{t-k+1}$};
\node (dots)    [minimum size=13mm,right=of r_t_k_1] {\huge $\cdots$};
\node (r_t_1)   [input_circle,right=of dots]        {$r_{t-1}$};
\node (r_t)     [input_circle,right=of r_t_1]       {$r_t$};

\coordinate[below=of dots] (aux);
\node (arrow1)  [big_arrow, 
                 rotate around={270:(0,0)},
                 at={(aux)}]  {a};
\node (lstm)    [cascaded=6cm/1.5cm/orange, 
                 below=12mm of aux] {\Large LSTM};
    \end{tikzpicture}
\end{document}

enter image description here

1
  • The first one is exactly what I want! I actually don't need the "a" there. Thanks again!
    – stevew
    Feb 6, 2022 at 9:38
3

Another way to do that is to treat position and node content separately, using :

\coordinate[below=0.2cm of dots.south] (arrow1);
\node at (arrow1) [big_arrow,rotate=-90] {a};

instead of

\node (arrow1) [big_arrow,rotate=-90,below=0.2cm of dots.south] {a};

See :

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

\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.pathreplacing,angles,quotes}
\usetikzlibrary{shapes.geometric,shapes.arrows}
\usetikzlibrary{shadows}

\begin{document}

\tikzset{%
    input_circle/.style={%
        draw,
        circle,
        minimum size=1.3cm,
        fill=yellow,
        font=\small
    },
    solid_box/.style={%
        draw,
        thick,
        centered
    },
    cascaded/.style={%
        solid_box,
        double copy shadow={
            shadow xshift=-1ex,
            shadow yshift=1ex
        }
    },
    big_arrow/.style={%
        single arrow,
        draw,
        fill=gray
    }
}
\begin{tikzpicture}

    \node (r_t_k) at (0,0) [input_circle] {$r_{t-k}$};
    \node (r_t_k_1) [input_circle,right=0.5cm of r_t_k] {$r_{t-k+1}$};
    \node (dots) [minimum size=2cm,right=0.5cm of r_t_k_1] {\huge $\cdots$};
    \node (r_t_1) [input_circle,right=0.5cm of dots] {$r_{t-1}$};
    \node (r_t) [input_circle,right=0.5cm of r_t_1] {$r_t$};

    \coordinate[below=0.2cm of dots.south] (arrow1);
    \node at (arrow1) [big_arrow,rotate=-90] {a};
    
    % lstm
    \node (lstm) [cascaded, minimum width=6cm, minimum height=1.5cm, fill=orange, below=1cm of arrow1] {\Large LSTM};

\end{tikzpicture}

\end{document}

enter image description here

1
  • Thanks. The "a" actually doesn't need to be there so this works too.
    – stevew
    Feb 7, 2022 at 10:14

You must log in to answer this question.

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