在节点内的框中应用文本来绘制情节线

在节点内的框中应用文本来绘制情节线

以下代码来自此答案问题。如何将其应用于绘制情节线代码,来自此答案问题

我的意思是我想将代码(在应用于绿线的节点内的框中插入文本)应用于(在轴定义内绘制图)绘制的蓝线。

    \documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{1}
\tikzset{
declare function={
%        myslope2(\x) = 24 - \x*(24/48);
    myslope(\x) = 8 - \x*(8/32);
    mycomplexfunction(\x) = sin(60*pow(\x,1.2)) + 6;
},
}
\begin{tikzpicture}[
dot/.style = {circle, black, scale=.8, fill, node contents={}},
aligned pin/.style args={[#1]#2:#3}%
  {pin={[pin distance=10mm, pin edge={black, very thick, shorten >=-12pt},
    label={[append after command={%
      node[text width=35mm, color=black, fill=yellow!35, xshift=0cm, yshift=0cm, outer sep=0pt, inner sep=5pt,%
        at=(\tikzlastnode.#2),
        anchor=#1,
        ]{#3}}]center:{}}
        ]#2:{}}%
  },
scale=.9, transform shape]
\begin{axis}[
 axis lines=center, axis line style={black, thick,-latex},
 axis y line=left,axis x line=bottom,
 tick style={line width=.04cm, color=black, line cap=round},
 font=\normalsize,color=black,
 xmin=0, xmax=64,
 xtick={0,16,32}, xticklabels={0,16,32},
 ymin=0, ymax=16,
 ytick={4,8}, yticklabels={4,8},
 tickwidth=.2cm,
 xlabel={P}, xlabel style={right},
 ylabel={M}, ylabel style={above},
 xticklabel style={inner xsep=0cm, xshift=0cm,yshift=-.1cm},
 yticklabel style={inner ysep=0cm,xshift=-.1cm,yshift=0cm},
 samples=200,
 clip=false]
\draw[ultra thick,blue] plot[samples at={0,16,32},mark=*,mark options={black}] (axis cs:\x,{myslope(\x)});
\draw[thick,black,densely dotted] (axis cs:0,{myslope(16)}) -- (axis cs:16,{myslope(16)}) node [black, xshift=.46cm, yshift=.05cm] {A} -- (axis cs:16,0);
\end{axis}
\draw [thick,green] (0,2.84) -- node [dot, aligned pin={[south west]45:very very very very long long long  long text}] + (-40:4.44cm) node [pos=0, circle, draw, black, fill=black, scale=0.5]{} node [pos=1, circle, draw, black, fill=black, scale=0.5]{};
\end{tikzpicture}
\end{frame}
\end{document}

在此处输入图片描述

答案1

我尝试了下面的代码\node at (axis cs:16,{myslope(16)}) [dot, aligned pin={[south west]45:very very very very long long long long text}]; 并且运行良好。

相关内容