你能提示我如何绘制这样的情节吗?我真的不知道该如何开始。
我可以画两条直线,但弯曲它们时就会出现问题。更不用说标签之间的间隙了 :(
梅威瑟:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{ticks=none}
\usetikzlibrary{intersections, calc}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
%grid = major,
axis x line=left,
axis y line=left,
xlabel={Amount of data},
ylabel={Performance}
]
\addplot+[color=black,mark=none,samples=200,domain=0:10,smooth,thick] {*sqrt(1*x)} node[below,pos=1,color=black] {};
\addplot+[color=blue,mark=none,samples=200,domain=0:10,smooth,thick] {2/8*sqrt(3*x)} node[below,pos=1,color=black] {};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
类似这样的事?
\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}