\documentclass{article}
\usepackage{animate}
\usepackage{tikz}
\usepackage{tkz-graph}
\usetikzlibrary{arrows}
\usetikzlibrary{lindenmayersystems}
\usepackage[paperheight=20.2cm,paperwidth=16.2cm,bottom=-1cm,top=-1cm,left=-1.8cm,right=0cm]{geometry}
\begin{document}
\begin{tikzpicture}
\foreach \x in {31,91,...,391}{%
\draw (\x:3cm) circle (5pt)[fill=black];
\draw (\x:5cm) circle (5pt)[fill=black];
\draw (\x:3cm) [line width=1pt]-- (\x+60:3cm);
\draw (\x:3cm) [line width=1pt]-- (\x+120:3cm);
\draw (\x:3cm) [line width=1pt]-- (\x+180:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x-60:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x+60:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x-120:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x+120:3cm);
\draw (\x:5cm)[line width=1pt]..controls(\x+120:11cm)..(\x+180:3cm);
%\draw (\x:3cm) [line width=3pt] -- (\x+144:3cm);
%\draw (\x:3cm) [line width=3pt] -- (\x:3cm);}
\draw(31:3cm)node[right=2pt]{\huge $v_6$};
\draw(91:3cm)node[above=2pt]{\huge $v_1$};
\draw(151:3cm)node[left=2pt]{\huge $v_2$};
\draw(211:3cm)node[left=2pt]{\huge $v_3$};
\draw(271:3cm)node[below=2pt]{\huge $v_4$};
\draw(331:3cm)node[right=2pt]{\huge $v_5$};
\draw(271:5cm)node[below=3.5cm]{\huge $S'(K_6)$};
\draw(31:5cm)node[right=2pt]{\huge $v_6'$};
\draw(91:5cm)node[above=2pt]{\huge $v_1'$};
\draw(151:5cm)node[left=2pt]{\huge $v_2'$};
\draw(211:5cm)node[left=2pt]{\huge $v_3'$};
\draw(271:5cm)node[below=2pt]{\huge $v_4'$};
\draw(331:5cm)node[right=2pt]{\huge $v_5'$};
\end{tikzpicture}
\end{document}
我正在繪製上面的圖表,其中內部標籤與邊緣重疊。如果有人可以重疊繪製,或者如果有人可以以不同的方式繪製相同的圖形,這對我也會有幫助。
答案1
首先,您的程式碼中有一個錯誤:您註解掉了終止循環體的大括號foreach
。
關於您的佈局問題:使用controls
兩點。
\draw (A) .. controls (a) and (b) .. (B);
(A)
該線將從的方向離開並從 的方向(a)
接近。(B)
(b)
在您的應用程式中考慮替換
\draw (\x:5cm)[line width=1pt]..controls(\x+120:11cm)..(\x+180:3cm);
經過
\draw (\x:5cm)[line width=1pt]..controls(\x+100:10cm) and (\x+120:11cm)..(\x+180:3cm);
\documentclass{article}
\usepackage{animate}
\usepackage{tikz}
\usepackage{tkz-graph}
\usetikzlibrary{arrows}
\usetikzlibrary{lindenmayersystems}
\usepackage[paperheight=20.2cm,paperwidth=16.2cm,bottom=-1cm,top=-1cm,left=-1.8cm,right=0cm]{geometry}
\begin{document}
\begin{tikzpicture}
\foreach \x in {31,91,...,391}{%
\draw (\x:3cm) circle (5pt)[fill=black];
\draw (\x:5cm) circle (5pt)[fill=black];
\draw (\x:3cm) [line width=1pt]-- (\x+60:3cm);
\draw (\x:3cm) [line width=1pt]-- (\x+120:3cm);
\draw (\x:3cm) [line width=1pt]-- (\x+180:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x-60:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x+60:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x-120:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x+120:3cm);
%\draw (\x:5cm)[line width=1pt]..controls(\x+120:11cm)..(\x+180:3cm);
\draw (\x:5cm)[line width=1pt]..controls(\x+100:10cm) and (\x+120:11cm)..(\x+180:3cm);
%\draw (\x:3cm) [line width=3pt] -- (\x+144:3cm);
%\draw (\x:3cm) [line width=3pt] -- (\x:3cm);
}
\draw(31:3cm)node[right=2pt]{\huge $v_6$};
\draw(91:3cm)node[above=2pt]{\huge $v_1$};
\draw(151:3cm)node[left=2pt]{\huge $v_2$};
\draw(211:3cm)node[left=2pt]{\huge $v_3$};
\draw(271:3cm)node[below=2pt]{\huge $v_4$};
\draw(331:3cm)node[right=2pt]{\huge $v_5$};
\draw(271:5cm)node[below=3.5cm]{\huge $S'(K_6)$};
\draw(31:5cm)node[right=2pt]{\huge $v_6'$};
\draw(91:5cm)node[above=2pt]{\huge $v_1'$};
\draw(151:5cm)node[left=2pt]{\huge $v_2'$};
\draw(211:5cm)node[left=2pt]{\huge $v_3'$};
\draw(271:5cm)node[below=2pt]{\huge $v_4'$};
\draw(331:5cm)node[right=2pt]{\huge $v_5'$};
\end{tikzpicture}
\end{document}