你能帮我这个忙吗?
另外,如果你能帮助我解决这个问题,我会很高兴:
mwe
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
%\pgfplotsset{}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\begin{axis}[ticks=none,ymax=2.3,
%grid = major,
axis x line=left,
axis y line=left,
xlabel={Amount of data},
ylabel={Performance}
]
\addplot[color=red,mark=none,samples=200,domain=0:10,smooth,thick] {tanh(x)}
node[above left,pos=1] {Older algorithms};
\addplot[color=blue,mark=none,samples=200,domain=1:10,smooth,thick]
{1/3*sqrt(3*x-3)} node[above left,pos=0.8] {Deep learning};
\draw[dashed,gray] (6,0) -- (6,{1/3*sqrt(3*6-3)}) node[fill=black,circle,inner sep=2pt] (n1){};
\draw[dashed,gray] (9,0) -- (9,{1/3*sqrt(3*9-3)}) node[fill=black,circle,inner sep=2pt] (n2){};
\end{axis}
\draw[gray] (n1) -- ([xshift=1cm]current axis.east|-n1) node[right]{blah};
\draw[gray] (n2) -- ([xshift=1cm]current axis.east|-n2) node[right]{blah blah};
\end{tikzpicture}
\end{document}
答案1
通过组合一些基本函数,可以很容易地重现任何图。计算机代数系统允许您系统地执行此操作,但即使如此,pgfplots
如果您自己尝试几次,您也可以学会猜测函数。
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=left,domain=0:5,ymin=0,ymax=2,xmax=7,xtick=\empty,ytick=\empty,
xlabel={amount of training},ylabel={$E$}]
\addplot[color=red,smooth] {exp(-x)+0.3} node[pos=1,right,black]{Training};
\addplot[color=blue,smooth] {1+0.6*exp(-x)-0.1*sin(108*x)-0.1*sin(x*72)}
node[pos=1,right,black]{Validation};
\path (1.3,1.7) coordinate(t) (1.3,-0.1) coordinate(b);
\end{axis}
\draw[dashed] (t) -- (b);
\draw[stealth-] (b) -- ++ (-0.5,-0.5) node[below]{Stop training here};
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[axis lines=left,domain=0:5,ymin=0,ymax=1.5,xmax=6,clip=false,
xtick=\empty,ytick=\empty,xlabel={amount of training},ylabel={$E$}]
\addplot[color=red,smooth] {min(1,exp(-x+0.2))+0.3}
coordinate[pos=0.9] (p1)
node[pos=1,above right,black](TSS1){Training set error};
\addplot[color=blue,smooth] {0.2+0.8*min(1,exp(-2*x+0.3))+0.6*exp(-pow(x-5.1,2)/5)}
coordinate[pos=0.9] (p2)
node[pos=1,above right,black](TSS2){Test set error};
\draw[dashed] (1.3,1.2) -- (1.3,-0.1);
\draw[stealth-] (1.3,1.2) -- ++ (0.5,0.25) node[above]{Stopping point};
\draw[-stealth] (TSS1.west) to[bend right] (p1);
\draw[-stealth] (TSS2.west) to[bend right] (p2);
\end{axis}
\end{tikzpicture}
\end{document}