我正在尝试获取如下图片
我目前拥有的
\begin{tikzpicture}
\node (pol) [draw, thick, blue!90!black,rotate=90,minimum size=2.5cm,regular polygon, regular polygon sides=7] at (0,0) {};
\foreach \n [count=\nu from 0, remember=\n as \lastn, evaluate={\nu+\lastn}] in {1,2,3,4,5,6,7}
\node[anchor=\n*(360/7)]at(pol.corner \n){$\omega_{\nu}$};
\end{tikzpicture}
这得出
答案1
我不会制作六边形,而是制作七边形,但不会绘制其中一个节点。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[dot/.style={draw,fill,circle,inner sep=1pt}]
\foreach \l [count=\n] in {0,1,2,3,{},n-2,n-1} {
\pgfmathsetmacro\angle{90-360/7*(\n-1)}
\ifnum\n=5
\coordinate (n\n) at (\angle:1);
\else
\node[dot,label={\angle:$\l$}] (n\n) at (\angle:1) {};
\fi
}
\draw (n6) -- (n7) -- (n1) -- (n2) -- (n3) -- (n4);
\draw[dashed,shorten >=5pt] (n4) -- (n5);
\draw[dashed,shorten >=5pt] (n6) -- (n5);
\end{tikzpicture}
\end{document}
答案2
我可能会尝试类似的事情。
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \X/\Y [count=\Z] in {-60/3,-10/2,40/1,90/0,140/{$n-1$},190/{$n-2$}}
{\path (0,0) -- (\X:2.5) coordinate[pos=0.75] (C\Z)
node[anchor={180+\X},pos=0.85]{\Y};
\fill (C\Z) circle (2pt);}
\foreach \X [count=\Y] in {2,...,6}
{\draw (C\X) -- (C\Y);}
\draw[dashed,thick, shorten >=0.6cm] (-60:{2.5*0.75}) -- (-110:{2.5*0.75});
\draw[dashed,thick, shorten >=0.6cm] (-170:{2.5*0.75}) -- (-120:{2.5*0.75}) ;
\end{tikzpicture}
\end{document}
更新:修复了 Henri Menke 报告的一个错误,并使内容与 OP 的图片更加相似。
答案3
这是一个使用“正七边形”节点的解决方案。
\documentclass[tikz,border=7pt]{standalone}
\usetikzlibrary{shapes.geometric}
\tikzset{
heptagon/.style={
shape=regular polygon, regular polygon sides=7,
outer sep=0, minimum size=3cm, rotate=4*360/7,
draw, dashed
}
}
\begin{document}
\begin{tikzpicture}
\draw node[heptagon](H){} (H.corner 1)
foreach[count=\i] \x in {3,...,0,n-2,n-1}{--(H.corner \i) node[scale=3]{.}[scale=1.3]node{\x}};
\fill[white] (H.corner 7) circle(.4);
\end{tikzpicture}
\end{document}