Bestimmte Punkte im Tikz-Diagramm kommentieren

Bestimmte Punkte im Tikz-Diagramm kommentieren

Ich stelle eine Exponentialfunktion dar und muss in meinem Diagramm einige bestimmte Werte hervorheben.

Punktname (x;y)

Punkt N1 (2;50)

Punkt N2 (4;25)

Ich versuche zu folgenGonzalo Medinas Antwortaber ich habe keinen Erfolg

\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}

Beachten Sie, dass ich nur versucht habe, N1 hierher zu richten, und selbst das funktioniert nicht. Außerdem möchte ich keine Linie zeichnen, nur um den Schnittpunkt zu erstellen, aber ich weiß nicht, wie ich das anders machen kann.

Irgendein Rat?

Antwort1

Eine Alternative zur Alenanno-Antwort mit Knotennamen bei Knoten:

\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}

Im obigen Code gehe ich davon aus, dass das aktuelle pgfplotsPaket verfügbar ist. Falls es vor Version 1.11 liegt, sollte in den Koordinaten axis cs:etwas wie hinzugefügt werden (axis cs:1,25).

Bildbeschreibung hier eingeben

Antwort2

Normalerweise bräuchte man Schnittpunkte, um gute Arbeit zu leisten. Es gäbe andere Lösungen, aber die, die mir einfallen, erfordern sogar noch mehr Code als bloße Schnittpunkte. In Ihrem Fall brauchen Sie jedoch nicht einmal Schnittpunkte. Sie können einfach die Linien zeichnen.

Ausgabe

Bildbeschreibung hier eingeben

Code

\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}

verwandte Informationen