我正在绘制彼得森图。但图的边与节点重叠。
\documentclass{article}
\usepackage{animate}
\usepackage{tikz}
\usepackage{tkz-graph}
\usetikzlibrary{arrows}
\usetikzlibrary{lindenmayersystems}
\usepackage[paperheight=11cm,paperwidth=30cm,bottom=0cm,top=0.21cm,left=0cm,right=0cm]{geometry}
\begin{document}
\begin{tikzpicture}
\foreach \x in {18,90,...,306}
{
\draw(\x:5cm) circle (7pt)[fill=blue];
\draw(\x:3cm) circle (7pt)[fill=red];
\draw(\x:5cm) [line width=3pt]-- (\x+72:5cm);
\draw(\x:3cm) [line width=3pt] -- (\x+144:3cm);
\draw(\x:5cm) [line width=3pt] -- (\x:3cm);
}
\end{tikzpicture}
\end{document}
答案1
仅使用另一个循环来绘制圆圈,这样圆圈就会绘制在线上。
\begin{tikzpicture}
\foreach \x in {18,90,...,306}{%
\draw (\x:5cm) [line width=3pt]-- (\x+72 :5cm);
\draw (\x:3cm) [line width=3pt] -- (\x+144:3cm);
\draw (\x:5cm) [line width=3pt] -- (\x :3cm);
}
\foreach \x in {18,90,...,306}{%
\draw (\x:5cm) circle (7pt) [fill=blue];
\draw (\x:3cm) circle (7pt) [fill=red];
}
\end{tikzpicture}