1

I want this tikz picture to animate as follows:

\documentclass[border=2mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text, fit}
\usetikzlibrary{positioning,fit,backgrounds,arrows.meta}
\begin{document}
    \begin{tikzpicture}[scale=2,
        fatnode1/.style={rectangle, draw=blue, rounded corners, fill=blue!20, minimum size=0.0mm},
        fatnode2/.style={rectangle, draw=red, rounded corners, fill=red!20, minimum size=0.0mm},
        font=\sf,
        >=Latex,
        thick,
        node distance=1.2]
        \node[fatnode1] (A) at (0, 0) {Data Importation};
        \node[fatnode1, right=of A] (B) {Data Cleaning};
        \node[fatnode2, right=of B] (C) {Data Wrangling};
        \node[fatnode2, above right=of C] (D) {Data Visualization};
        \node[fatnode1, below right=of C] (E) {Data Modeling};
        \node [xshift=1.2cm, right=of C] (F) {};
        \begin{pgfonlayer}{background}
        \node [fill=blue!10, rounded corners, fit= (C) (D) (E) (F)] (H) {}; % enough to add two diagonal nodes
        \end{pgfonlayer}
        \node[fatnode2, fill=white] (I) at (H.220) {\footnotesize Data Exploration};
        \node[fatnode1, right=of H] (G) {Communicate Resuls};
        \draw [thick, ->] (A) -- (B);
        \draw [thick, ->] (B) -- (C);
        \draw [thick, ->] (H) -- (G);
        \draw [->,thick] (C) to [bend left=40]  (D);
        \draw [->,thick] (D) to [bend left=45]  (E);
        \draw [->,thick] (E) to [bend left=45]  (C);
        \node[draw, rounded corners, fit=(A) (B) (C) (D) (E) (G) (H) (I)] {};
    \end{tikzpicture}

\end{document}

My Workflow in Tikz

  • I want Data Importation to appear, then Data Cleaning to appear.

  • I want the Circle to rotate along with Data Wrangling, Data Visualization, Data Modeling.

  • I want Communicate Result to then appear.

This answer interests me but I can not figure it out in my own case.

EDIT

Here are

item1, item2, item3, item4, item5 and item6

  • 2
    Use standalone class. Make several different tikzpicture of each step, compile. You'll obtain as many slides as wanted and can use them to animate your picture. – SebGlav Jul 01 '21 at 05:26
  • 2
    Do you want an animated GIF, an animation with control buttons, a PDF slideshow where the elements appear on each slide or an interactive PDF with checkboxes to make each element appear separately from the others? – AndréC Jul 01 '21 at 06:43
  • 1
    This would be quite straightforward with beamer overlays, if using beamer is acceptable. As commented by @AndréC, you need to specify which kind of output you want. – Rmano Jul 01 '21 at 06:55
  • My goal is to get a .gif file that I can load into RMarkdown outputted on ioslides. – Daniel James Jul 01 '21 at 18:18
  • My goal is to get a .gif file that I can load into RMarkdown outputted on ioslides. – Daniel James Jul 01 '21 at 18:18
  • I truly need animated gif – Daniel James Jul 01 '21 at 19:28

1 Answers1

5

This is a combination of beamer overlays and of the animate package to show the requested steps of the illustration and to animate the arrows. The animated arrow heads are placed with the help of the decorations.markings library.

The tikzpicture was wrapped in a command to accept parameters (step id, arrow head position). Also, it was necessary to resize it to make it fit into a beamer slide.

enter image description here

\documentclass{beamer}

\usepackage{tikz} \usetikzlibrary{decorations.text, decorations.markings} \usetikzlibrary{positioning,fit,backgrounds,arrows.meta} \usepackage{animate}

\newcommand\steppedChart[2]{% % #1 major steps: 0 ( ); 1 (Data Importation); 2 (Data Cleaning); 3 (Data Exploration); 4 (Communicate Results) % #2 arrow positions (0.0...1.0) in 3 \resizebox{\linewidth}{!}{% \begin{tikzpicture}[ fatnode1/.style={rectangle, draw=blue, rounded corners, fill=blue!20, minimum size=0.0mm}, fatnode2/.style={rectangle, draw=red, rounded corners, fill=red!20, minimum size=0.0mm}, font=\sf, >=Latex, thick, node distance=1.2] \ifnum#1>0 \node[fatnode1] (A) at (0, 0) {Data Importation}; \fi \ifnum#1>1 \node[fatnode1, right=of A] (B) {Data Cleaning}; \draw [thick, ->] (A) -- (B); \fi \ifnum#1>2 \node[fatnode2, right=of B] (C) {Data Wrangling}; \draw [thick, ->] (B) -- (C); \node[fatnode2, above right=of C] (D) {Data Visualization}; \node[fatnode1, below right=of C] (E) {Data Modeling}; \node [xshift=1.2cm, right=of C] (F) {}; \begin{pgfonlayer}{background} \node [fill=blue!10, rounded corners, fit= (C) (D) (E) (F)] (H) {}; % enough to add two diagonal nodes \tikzset{decoration={markings, mark= at position #2 with {\arrow{>}}}} \draw [postaction={decorate},thick] (C.center) to [bend left=40] (D.center); \draw [postaction={decorate},thick] (D.center) to [bend left=45] (E.center); \draw [postaction={decorate},thick] (E.center) to [bend left=45] (C.center); \end{pgfonlayer} \node[fatnode2, fill=white] (I) at (H.220) {\footnotesize Data Exploration}; \fi
\ifnum#1>3 \node[fatnode1, right=of H] (G) {Communicate Resuls}; \draw [thick, ->] (H) -- (G); %%%%% measure and save bounding box coordinates %%%%% \pgfpointanchor{current bounding box}{south west}\pgfgetlastxy{\llx}{\lly} \xdef\LL{canvas cs:x=\llx,y=\lly} \pgfpointanchor{current bounding box}{north east}\pgfgetlastxy{\urx}{\ury} \xdef\UR{canvas cs:x=\urx,y=\ury} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi \coordinate (LL) at (\LL);\coordinate (UR) at (\UR); \node[draw, rounded corners, fit=(LL) (UR)] {}; \end{tikzpicture}}% }

\begin{document} \begin{frame}[t]{Animated Chart} \sbox{0}{\steppedChart{4}{0}}% measure BBOX \only<1>{\steppedChart{0}{0}}% \only<2>{\steppedChart{1}{0}}% \only<3>{\steppedChart{2}{0}}% \only<4>{% \begin{animateinline}[autoplay,loop]{25}% \multiframe{21}{r=0+0.05}{\steppedChart{3}{\r}}% \end{animateinline}% }% \only<5>{% \begin{animateinline}[autoplay,loop]{25}% \multiframe{21}{r=0+0.05}{\steppedChart{4}{\r}}% \end{animateinline}% }%
\end{frame} \end{document}

AlexG
  • 54,894