0

enter image description here

I want to display the graph in beamer so that at each click of the entry we see the next step but of course in a single graph

\begin{figure}[!h]
\begin{center}
\begin{tikzpicture}[x=1.5cm,>=latex]
\draw [->] (-4.5,-1)--(.5,-1);
\foreach \i in {-4,...,0} {
  \draw (\i,-.9)--(\i,-1.1) node[below] {\i};
}
\foreach \i/\j in {-4/4,-4/3,-4/2,-4/1,-3/2,-2/3,-3/1,-2/2,-1/3,-1/4,0/3,0/4} {\node[draw,circle,fill=cyan!9](\i_\j) at (\i,4-\j) {$\j$};
}
\foreach \i/\j in {-3/4,-2/1,-1/2,-3/3,-2/4,-1/1,0/2,0/1} {\node[draw,circle,dash pattern=on 1.5pt off 1.5pt](\i_\j) at (\i,4-\j) {$\j$};
}
\foreach \j in {2,1} \draw[->](-4_\j)--(-3_1);  \draw[->](-4_4)--(-3_2);
\draw[->](-3_1)--(-2_2);
\draw[->] (-3_2)--(-2_3);
\draw[->](-3_3)--(-2_4);
\draw[->](-2_4)--(-1_4);
\draw[->](-2_2)--(-1_3);
\draw[->](-4_3)--(-3_2);
 \draw[->](-1_4)--(0_3); \draw[->](-1_3)--(0_4);

\draw[->,dash pattern=on 1.5pt off 1.5pt] (-3_4)--(-2_3);
\draw[->,dash pattern=on 1.5pt off 1.5pt] (-2_1)--(-1_3);
\draw[->,] (-2_3)--(-1_4);
\draw[->,dash pattern=on 1.5pt off 1.5pt] (-1_1)--(0_2);
\draw[->,dash pattern=on 1.5pt off 1.5pt] (-1_2)--(0_1);
% les légendes au dessus du graphe
\draw (-3.5,3.7) node [scale=0.7] {$u_3=0.12$};
\draw (-2.5,3.7) node [scale=0.7] {$u_2=0.52$};
\draw (-1.5,3.7) node [scale=0.7] {$u_1=0.9$};
\draw (-0.5,3.7) node [scale=0.7] {$u_0=0.47$};
\end{tikzpicture}
\end{center}
\caption{troisième étape du couplage en arrière}
\end{figure}

so that each arrow of first state generates the peremiemier ensuit the second state and so following consequently in goes back in the time and one remakes the same states after the states that did not get arrows ol draw it by chest

  • I heard there is a bemer-overlay tikzlibrary, but cannot find it. You could overlay tikzpictures using [remember picture, overlay] and add them one at a time. You could also copy and paste the whole thing, using [opacity=0] for the parts to remain invisible. – John Kormylo Jul 13 '18 at 13:03
  • (For those viewing this, fyi.) OP reposted the same question 40 minutes later at tex.stackexchange.com/q/440479/107497. – Teepeemm Jul 13 '18 at 16:19
  • If you like an answer and it was helpful, please consider upvoting (by clicking on the arrows next to the score) and marking it as accepted answer (by clicking on the checkmark ✓). – Andrew Jul 16 '18 at 2:55
3

Using a much more minimal MWE. this illustrate my comment. Note that you have to run LaTeX twice to get the first three slides to align. The opacity=0 approach works better for centering (figure environment) although you have to be careful not to add extra spaces.

\documentclass{beamer}
\usepackage{tikz}
\begin{document}

\begin{frame}
\begin{figure}
\begin{tikzpicture}[remember picture]
  \node[draw,circle] (A) {First};
  \path (4,0);% set right boundary for centering
\end{tikzpicture}
\onslide<2-> {\begin{tikzpicture}[remember picture, overlay]
  \node[draw,circle,right=1.5cm] (B) at (A) {Second};
  \draw[->] (A) -- (B);
  \end{tikzpicture}}
\onslide<3-> {\begin{tikzpicture}[remember picture, overlay]
  \node[draw,circle,right=1.5cm] (C) at (B) {Third};
  \draw[->] (B) -- (C);
  \end{tikzpicture}}
\end{figure}
\end{frame}


\begin{frame}
\begin{figure}
\only<1> {\begin{tikzpicture}
  \node[draw,circle] (A) {First};
  \begin{scope}[opacity=0]
    \node[draw,circle,right=1.5cm] (B) at (A) {Second};
    \draw[->] (A) -- (B);
    \node[draw,circle,right=1.5cm] (C) at (B) {Third};
    \draw[->] (B) -- (C);
  \end{scope}
  \end{tikzpicture}}%
\only<2>{\begin{tikzpicture}
  \node[draw,circle] (A) {First};
  \node[draw,circle,right=1.5cm] (B) at (A) {Second};
  \draw[->] (A) -- (B);
  \begin{scope}[opacity=0]
    \node[draw,circle,right=1.5cm] (C) at (B) {Third};
    \draw[->] (B) -- (C);
  \end{scope}
  \end{tikzpicture}}%
\only<3>{\begin{tikzpicture}
  \node[draw,circle] (A) {First};
  \node[draw,circle,right=1.5cm] (B) at (A) {Second};
  \draw[->] (A) -- (B);
  \node[draw,circle,right=1.5cm] (C) at (B) {Third};
  \draw[->] (B) -- (C);
  \end{tikzpicture}}%
\end{figure}
\end{frame}

\end{document} 

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.