오버레이 번호와 함께 진화하는 "현재 위치"가 있는 시간 화살표

오버레이 번호와 함께 진화하는 "현재 위치"가 있는 시간 화살표

저는 스냅샷을 통해 시간의 변화를 보여주는 슬라이드를 보여주고 있습니다. 각 스냅샷은 특정 시간에 해당합니다.

각 시간 지점(불균등한 간격)에 해당하는 글머리 기호가 있는 시간 화살표(측면에 수직)를 표시하고 싶습니다. 각 오버레이에서 이러한 글머리 기호 중 하나는 단색으로 채워지고 현재 시간이 지정되는 반면, 다른 글머리 기호는 열려 있습니다(빈 원).

를 사용하면 첨예화되지 않은 버전을 아주 쉽게 할 수 있을 것 같은데 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위 의 시작점을 설정했습니다.= 0 그리고 항상 마지막 점 아래 1.4mm인 마지막 점을 추가합니다.. (선의 상단 시작이 첫 번째보다 고정된 거리가 되도록 해야 하는 경우여기에서는 조정이 필요합니다.) 마지막 화살표도 결합되어 ->실제 화살표 끝을 얻습니다.

화살표 팁이라고 하면,Circle좋은 것 같습니다. 중심에 놓이는 대신 지정된 좌표만 터치합니다. 이것은 될 수있다결정된, 여기서는 원 노드를 사용하겠습니다.

다이어그램 비머를 인식하게 하기 위해 <.>다음에서 구문을 훔쳤습니다.샘 카터의 답변갖다label노드 채우기와 동시에 나타납니다. 화살표 끝 대신 원형 노드를 참조로 사용하고 있기 때문에 내 생각에는 노드가 훨씬 더 잘 정렬될 것입니다.

label에 를 추가할 수도 있습니다 fill. 즉

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

하지만 라벨이 더 이상 경계 상자에 기여하지 않는 한 그림이 이리저리 뛰어다니게 됩니다. 의 솔루션은 프레임에 숨겨진 텍스트(선택 및 복사 가능)를 남겨두기
때문에 저는 비머 자체를 사용하여 텍스트를 숨깁니다.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

\draw와 같은 tikz 명령이 오버레이를 인식한다는 사실을 활용할 수 있습니다 .

\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

관련 정보