オーバーレイ番号とともに進化する「現在の位置」を示す時間矢印

オーバーレイ番号とともに進化する「現在の位置」を示す時間矢印

スナップショットをたどって時間の経過を示すスライドを示します。各スナップショットは特定の時間に対応しています。

各時点に対応する箇条書き(不等間隔)が付いた時間矢印(側面に垂直)を表示したいと思います。各オーバーレイでは、これらの箇条書きの 1 つが塗りつぶされて現在の時刻が指定されていますが、他の箇条書きは空白(空の円)になっています。

を使用すると、非修飾バージョンを簡単に作成できると思いますtikzが、オーバーレイ数に応じて要素のスタイルとノード テキストの存在を調整する方法がわかりません。

静的なタイムアローの MWE は次のとおりです。

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
  \def\axscale{-0.02}
  \def\thex{0}
  \def\they{0}
  \def\prevy{0}
  \def\times{{-5,2, 12, 22, 32, 44, 76, 116, 182, 300,307}}
  \def\maxt{9}
  \foreach \it in {1,...,\maxt} {
        \pgfmathparse{\axscale*\times[\it-1]}
        \pgfmathsetmacro{\prevy}{\pgfmathresult}
        \pgfmathparse{\axscale*\times[\it]}
        \pgfmathsetmacro{\they}{\pgfmathresult}
        \draw[-{Circle[open]}] (\thex,\prevy) -- (\thex,\they);
        \node[right,anchor=west] at (\thex,\they) {
            $t=\pgfmathparse{\times[\it]}
            \pgfmathprintnumber[    % Print the result
                fixed,
                fixed zerofill,
                precision=0,
                assume math mode=true
            ]{\pgfmathresult}
            $};
  }
  \pgfmathparse{\axscale*\times[\maxt]}
  \pgfmathsetmacro{\prevy}{\pgfmathresult}
  \pgfmathparse{\axscale*\times[\maxt+1]}
  \pgfmathsetmacro{\they}{\pgfmathresult}
  \draw[->] (\thex,\prevy) -- (\thex,\they);
  %\draw(\thex,\prevy) -- (\thex+5,\they);
\end{tikzpicture}
\end{document}

アニメーション化する要素はCircle[open]、ラベルを表示するかどうかですt=...

答え1

答えは出たと思います。つまり、レイヤーを使うということです。TikZ、そして両方の回答は、これをどのように実行できるかを示しています。

TikZが提供するいくつかの便利な機能を使って、このタイムラインを描く別の方法を紹介したいと思います。主にキー/tikz/y長さと方向を変更できるええ軸のXYZ座標系(単位のないもの)。

を使用する代わりに、 (デフォルトは1cm)に\axscale設定すると、TikZは値を乗算して変換します。y-0.02cmキャンバス座標系(単位系)ええまだ上を向いています。

そして、chains図書館 私は実際にはそれを持たずにノードを結合するためにのみ使用していますどこへでも行ける1mmそのために、私は上記の開始点を設定しましたt= 0 とし、最後の点を常に最後の点より1.4mm下に追加します。t(線の上端を最初の線より一定距離上にする必要がある場合は、tここで調整が必要です。) 最後の 1 つも で結合され->、実際の矢印の先端が得られます。

矢先といえば、Circleヒントいいことのように思えますが、指定された座標に接するだけではなく、その座標を中心に配置します。これは修理済みただし、ここでは円形ノードを使用します。

ダイアグラムをビーマー対応にするために、私は<.>構文を盗用しましたサム・カーターの答え持つlabelノードの塗りつぶしと同時に表示されます。矢印の先端ではなく円形のノードを参照として使用しているため、ノードの整列がはるかに良くなると思います。

labelを に追加することもできますfill。つまり、

alt=<+>{fill, label={$t = \t$}}{}

ただし、ラベルが境界ボックスに寄与しなくなるまで、画像が飛び回ることになります。のソリューションではフレームに隠しテキストが残る
ため(選択してコピーできます)、私は Beamer 独自のテキストを使用してテキストを非表示にしています。visible onoverlay-beamer-styles\uncover

コード

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, chains, overlay-beamer-styles}
\begin{document}
\begin{frame}
\begin{itemize}[<+->]
\item First.
\item Second.
\end{itemize}

\begin{tikzpicture}[
  y=-.02cm, thick, label position=right, start chain = going {},
  dot/.style={circle, draw, inner sep=+0pt, minimum size=+1.3mm}]
\coordinate[on chain]() at (0, 1mm); % a start (for the line)
\foreach \t in {2, 12, 22, 32, 44, 76, 116, 182, 300}
  \node[dot, on chain, join, alt=<+>{fill},
    label/.expanded={$\uncover<.>{t = \t}$}, % no hidden text in output
%    label={[visible on=<.>]$t = \t$},       % hidden text in output
  ] at (0, \t) {};
% and an end that is below the last dot
\coordinate[on chain, join=by ->]() at ([yshift=-1.4mm] chain-end.south);
\end{tikzpicture}
\end{frame}
\end{document}

出力(クリックするとフルバージョンが表示されます)

サムネイルからフルファイルへ

答え2

のような tikz コマンドがオーバーレイを認識しているという事実を利用できます\draw

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{frame}
\begin{tikzpicture}
  \def\axscale{-0.02}
  \def\thex{0}
  \def\they{0}
  \def\prevy{0}
  \def\times{{-5,2, 12, 22, 32, 44, 76, 116, 182, 300,307}}
  \def\maxt{9}
  \foreach \it in {1,...,\maxt} {
        \pgfmathparse{\axscale*\times[\it-1]}
        \pgfmathsetmacro{\prevy}{\pgfmathresult}
        \pgfmathparse{\axscale*\times[\it]}
        \pgfmathsetmacro{\they}{\pgfmathresult}
        \draw[-{Circle[open]}] (\thex,\prevy) -- (\thex,\they);
        \draw<+(2)>[-{Circle}] (\thex,\prevy) -- (\thex,\they);
        \node<.(2)>[right,anchor=west] at (\thex,\they) {
            $t=\pgfmathparse{\times[\it]}
            \pgfmathprintnumber[    % Print the result
                fixed,
                fixed zerofill,
                precision=0,
                assume math mode=true
            ]{\pgfmathresult}
            $};
  }
  \pgfmathparse{\axscale*\times[\maxt]}
  \pgfmathsetmacro{\prevy}{\pgfmathresult}
  \pgfmathparse{\axscale*\times[\maxt+1]}
  \pgfmathsetmacro{\they}{\pgfmathresult}
  \draw[->] (\thex,\prevy) -- (\thex,\they);
  %\draw(\thex,\prevy) -- (\thex+5,\they);
\end{tikzpicture}
\end{frame}
\end{document}

ここに画像の説明を入力してください

答え3

素晴らしいoverlay-beamer-stylesライブラリを使用すると、次のことが可能になります。

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{overlay-beamer-styles}

\begin{document}
\begin{frame}

\begin{tikzpicture}
  \def\axscale{-0.02}
  \def\thex{0}
  \def\they{0}
  \def\prevy{0}
  \def\times{{-5, 2, 12, 22, 32, 44, 76, 116, 182, 300, 307}}
  \def\maxt{9}
  \foreach \it in {1,...,\maxt} {
        \pgfmathparse{\axscale*\times[\it-1]}
        \pgfmathsetmacro{\prevy}{\pgfmathresult}
        \pgfmathparse{\axscale*\times[\it]}
        \pgfmathsetmacro{\they}{\pgfmathresult}
        \draw[alt={<\it>{-{Circle[]}}{-{Circle[open]}}}] (\thex,\prevy) -- (\thex,\they);
        \node[right,anchor=west] at (\thex,\they) {
            $t=\pgfmathparse{\times[\it]}
            \pgfmathprintnumber[    % Print the result
                fixed,
                fixed zerofill,
                precision=0,
                assume math mode=true
            ]{\pgfmathresult}
            $};
  \pgfmathparse{\axscale*\times[\maxt]}
  \pgfmathsetmacro{\prevy}{\pgfmathresult}
  \pgfmathparse{\axscale*\times[\maxt+1]}
  \pgfmathsetmacro{\they}{\pgfmathresult}
  \draw[->] (\thex,\prevy) -- (\thex,\they);
  }
  %\draw(\thex,\prevy) -- (\thex+5,\they);
\end{tikzpicture}

\end{frame}
\end{document}

ここに画像の説明を入力してください

または、前のドットを埋めたままにしたい場合は、alt={<\it>{-{Circle[]}}{-{Circle[open]}}}を に置き換えるalt={<\it->{-{Circle[]}}{-{Circle[open]}}}(つまり、-の後にを追加する)こともできます。\it

関連情報