我怎样才能用 tikz 制作这样的图片?

我怎样才能用 tikz 制作这样的图片?

我想用 tikz 制作这样的图片

谢谢

在此处输入图片描述

答案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}

在此处输入图片描述

相关内容