![我怎样才能用 tikz 制作这样的图片?](https://linux22.com/image/399100/%E6%88%91%E6%80%8E%E6%A0%B7%E6%89%8D%E8%83%BD%E7%94%A8%20tikz%20%E5%88%B6%E4%BD%9C%E8%BF%99%E6%A0%B7%E7%9A%84%E5%9B%BE%E7%89%87%EF%BC%9F.png)
答案1
如果您知道曲线的公式,则可以按如下方式使用 tikz 包:
\documentclass{standalone}
\usepackage[dvipsnames,usenames]{xcolor}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[-latex] (0,0) -- (10,0) node[below] {$r$};
\draw[-latex] (0,0) -- (0,6) node[left] {$W$};
\draw[domain=0.2:9.8,blue,samples=300,Green,line width=1pt] plot ({\x},{1/\x})node[left,above]{rep1};
\end{tikzpicture}
\end{document}
答案2
如果您知道方程式,它必须是这样的(现在不记得真正的公式,但它是这样的):
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[-latex,thick,black] (0,0)--(5,0);
\draw[-latex,thick,black] (0,-4.5)--(0,4.5);
\draw[domain=0.5:4.5,thick,smooth,variable=\x,blue] plot ({\x},{-1/(\x*\x)});
\draw[domain=0.5:4.5,thick,smooth,variable=\x,red] plot ({\x},{0.5/(\x*\x*\x)});
\draw[domain=0.35:4.5,thick,dashed,variable=\x,green!60!black,samples=200] plot ({\x},{-1/(\x*\x))+0.5/(\x*\x*\x)});
\node[red] at (2,1) {attraction};
\node[blue] at (2,-1) {repulsion};
\node[green!60!black,rotate=45] at (0.49,-1.15) {resulted};
\end{tikzpicture}
\end{document}