您好,亲爱的 Texexchange 社区。
我是 Tikz 新手,我想为外平面图绘制曲线边缘。但是我无法将它们向外推得足够远以使其看起来正确。这是我的代码
\documentclass[tikz]{standalone}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture} [scale=1.5]
\tikzstyle {main}=[draw, circle, fill=black!30]
\node[main](1) at (1,2){1};
\node[main](2) at (2,2){2};
\node[main](3) at (3,1.5){3};
\node[main](4) at (3,0.5){4};
\node[main](8) at (0,1.5){8};
\node[main](7) at (0,0.5){7};
\node[main](5) at (2,0){5};
\node[main](6) at (1,0){6};
\draw (1)--(2)--(3)--(4)--(5)--(6)--(7)--(8);
\draw [->,red] (8.west) to [out=-160,in=-90] (4.south);
\end{tikzpicture}
有问题的边是代码中从 8 到 4 的边,它是红色的。
非常感谢你的帮助!Jakob
答案1
looseness
只需在曲线上添加一些即可。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture} [scale=1.5]
\tikzstyle {main}=[draw, circle, fill=black!30]
\node[main](1) at (1,2){1};
\node[main](2) at (2,2){2};
\node[main](3) at (3,1.5){3};
\node[main](4) at (3,0.5){4};
\node[main](8) at (0,1.5){8};
\node[main](7) at (0,0.5){7};
\node[main](5) at (2,0){5};
\node[main](6) at (1,0){6};
\draw (1)--(2)--(3)--(4)--(5)--(6)--(7)--(8);
\draw [->,red] (8.west) to [out=-160,in=-90,looseness=3] (4.south);
\draw [->,red] (8.south west) to [out=-140,in=-90,looseness=2] (5.south);
\end{tikzpicture}
\end{document}
您还可以使用贝塞尔曲线更准确地完成此操作。