Tikz 플롯의 특정 지점에 주석 달기

Tikz 플롯의 특정 지점에 주석 달기

지수 함수를 플롯하고 있는데 플롯에서 특정 값을 지적해야 합니다.

포인트 이름(x;y)

포인트 N1(2;50)

포인트 N2(4;25)

따라해보려고 해요곤잘로 메디나의 답변하지만 나는 어떤 성공도 얻지 못하고 있습니다

\begin{figure}[H]
\begin{tikzpicture}[scale=1.5]
\begin{axis}[
    domain=10:1,
    axis lines=left,
    grid=both,
    clip=false,
    xlabel=$Tempo (dias)$,
    ylabel=$Atividade (Ci)$
]
\addplot[name path=curve,smooth,thick,black]{100*exp(-x*ln(2)/2)};
\addplot[name path=line,smooth,dashed,red]{50};
\path[name intersections={of=curve and line, by={a}}];
\draw[dashed] 
  (a) -- (a|-{axis cs:0,0}) node[anchor=north,font=\tiny] {$N=1$};
\node[fill,inner sep=1.5pt] at (a) {};
\end{axis}
\end{tikzpicture}
\end{figure}

여기서는 N1만 가리키도록 시도했지만 심지어 작동하지 않습니다. 또한 교차점을 만들기 위해 선을 그리는 것을 원하지 않지만 다른 방법으로 수행하는 방법을 모르겠습니다.

어떤 충고?

답변1

노드 이름이 노드에 있는 Alenanno 답변의 대안:

\documentclass[margin=10pt]{standalone}
    \usepackage{pgfplots}
    \pgfplotsset{compat=1.13}

\begin{document}
    \begin{tikzpicture}[scale=1.5,
X/.style = {circle, fill=black, inner sep=1.5pt, 
            label={[font=\scriptsize]above right:#1},
            node contents={}}
                    ]
\begin{axis}[
    domain=10:1,
    axis lines=left,
    grid=both,
    clip=false,
    xlabel=\textit{Tempo (dias)},
    ylabel=\textit{Atividade (Ci)}
]
\addplot[smooth,thick,black]{100*exp(-x*ln(2)/2)};
%
\draw[dashed] (1,50) -- (2,50) node[X={$N=1$}] -- (2,3);
\draw[dashed] (1,25) -- (4,25) node[X={$N=2$}] -- (4,3);
\end{axis}
    \end{tikzpicture}
\end{document}

위의 코드에서는 최근 pgfplots패키지를 사용할 수 있다고 생각합니다. 1.11 이전 버전일 경우에는 axis cs:와 같은 좌표를 추가해야 합니다 (axis cs:1,25).

여기에 이미지 설명을 입력하세요

답변2

일반적으로 좋은 일을 하려면 교차로가 필요합니다. 다른 솔루션도 있을 수 있지만 제가 생각하는 솔루션에는 단순한 교차점보다 더 많은 코드가 필요합니다. 그래도 귀하의 경우에는 교차로가 필요하지 않습니다. 선을 그어주시면 됩니다.

산출

여기에 이미지 설명을 입력하세요

암호

\documentclass[margin=10pt]{standalone}
\usepackage{pgfplots}

\pgfplotsset{compat=1.13}

\tikzset{
    dot/.style={fill=black, circle, inner sep=1.5pt},
    nod/.style={sloped, at start, xshift=3mm, font=\scriptsize, above},
}

\begin{tikzpicture}[scale=1.5]
\begin{axis}[
    domain=10:1,
    axis lines=left,
    grid=both,
    clip=false,
    xlabel=Tempo (dias),
    ylabel=Atividade (Ci)
]
\addplot[name path=curve,smooth,thick,black]{100*exp(-x*ln(2)/2)};

\draw[dashed] (2,5) -- (2,50) coordinate[dot] node[nod] {$N=1$} -- (1,50);

\draw[dashed] (4,5) -- (4,25) coordinate[dot] node[nod] {$N=2$} -- (1,25);
\end{axis}
\end{tikzpicture}
\end{document}

관련 정보