在现有图旁添加草图

在现有图旁添加草图

我需要一些帮助来获得类似这样的情节:

在此处输入图片描述

借助这篇文章的帮助,我能够将图移到左侧(所附代码对 dy/dt 有不同的功能),我该如何将草图添加到右侧?谢谢。

以下是代码:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{datavisualization.formats.functions, arrows.meta}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\usetikzlibrary{decorations.pathreplacing,decorations.markings}
%\tikzset{arrow data/.style 2 args={%
%      decoration={%
%         markings,
%         mark=at position #1 with \arrow{#2}},
%         postaction=decorate}
%      }%

\tikzset{
      arrow data/.style={%
      decoration={%
         markings,
         mark=at position 0.025 with \arrowreversed{Straight Barb[length=4pt,width=6pt]},
         mark=at position 0.14 with \arrowreversed{Straight Barb[length=4pt,width=6pt]},
         mark=at position 0.28 with \arrow{Straight Barb[length=4pt,width=6pt]},
         mark=at position 0.38 with \arrow{Straight Barb[length=4pt,width=6pt]},
         mark=at position 0.5 with \arrowreversed{Straight Barb[length=4pt,width=6pt]},
         mark=at position 0.7 with \arrowreversed{Straight Barb[length=4pt,width=6pt]},
         },
         postaction=decorate}
      }%


\begin{document}

\def\cycles{16}
\pgfmathsetmacro\cyclesminusone{\cycles-1}

\begin{tikzpicture}
\begin{axis}[scale=0.9, xmin=0, xmax=16, ymin=-4, ymax=2, grid = both,
axis lines=middle,
axis line style={-Latex[round],thick},
xlabel=$y$,
xticklabels={},
extra x ticks={6,12},
extra x tick labels={6,12},
ylabel=$\frac{dy}{dt}$,
every axis y label/.style={
    at={(ticklabel* cs:1.00)},
    anchor=west},
every axis x label/.style={
    at={(ticklabel* cs:1.00)},
    anchor=west
},
clip mode=individual
]

\addplot[red, ultra thick,
postaction={decorate, decoration={markings,
%        mark=between positions 0.16 and 0.4 step 0.2 with {\arrow{<};},
%        mark=between positions 0.67 and 0.9 step 0.2 with {\arrow{>};}
mark=at position 0.04 with {\arrow[rotate=-176]{latex} ;},
mark=at position 0.15 with {\arrow[rotate=-180]{latex};},
mark=at position 0.25 with {\arrow{latex};},
mark=at position 0.35 with {\arrow{latex};},
mark=at position 0.47 with {\arrow[rotate=-180]{latex};}
%        mark=between positions 0.13 and 0.37 step 0.2 with {\arrow{<};},        mark=between positions 0.43 and 0.77 step 0.16 with {\arrow{>};},
%        mark=at position 0.9 with {\arrow{<};}
      }}
] expression[domain=0:20, samples=200]{1.2*x*(1-(x/15))-(4*x)/(0.5+x)};
\node[below,text=black] at (15,-2) {\bfseries{\emph{f(y)}}};

% x-values found by finding roots of function
\draw [dotted] (4.0779,0) -- (4.0779,-4);
\node[below,text=black,font=\footnotesize] at (2,-2) {extinction};
\node [below left] at (0,.3) {0};
\node [above left,red] at (4.4,0) {$\theta$};
\node [above right,red] at (10.2,0) {$\kappa$};

\end{axis}
\end{tikzpicture}


\begin{tikzpicture}
\begin{axis}[scale=0.9, xmin=0, xmax=16, ymin=-1, ymax=15, grid = none,
axis lines=middle,
axis line style={-Latex[round],thick},
xlabel=$t$,
xticklabels={},
ylabel=$y(t)$,
every axis y label/.style={
    at={(ticklabel* cs:1.00)},
    anchor=west},
every axis x label/.style={
    at={(ticklabel* cs:1.00)},
    anchor=west
},
yticklabels={},
extra y ticks={0,4.078,10.422},
extra x tick labels={0,4.078,10.422},
clip mode=individual
]
\draw[thick, color=blue] plot[domain=0:\cycles] (\x,{3*exp(-.2*\x)});
\draw [thin,dash dot] (0,4.078) -- (16,4.078);
\draw[thick, color=blue] plot[domain=0:\cycles] (\x,{10.77+3*exp(-.2*\x)});
\draw [thin,dash dot] (0,10.422) -- (16,10.422);

\addplot%
        [
            blue,%
            thick,
            mark=none,
            samples=100,
            domain=-5:16,
        ]
        (x,{10/(1+exp(-x))});

\end{axis}
\end{tikzpicture}

\end{document} 

相关内容