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}

関連情報