如何在 tikz 图形上放置悬挂点

如何在 tikz 图形上放置悬挂点

在此处输入图片描述

我想像上图一样放置悬挂点。我应该在下面的代码中添加什么?

\documentclass[12pt]{article}    
\usepackage{tikz}  
\begin{document}  
\begin{tikzpicture}[roundnode/.style={circle, fill=black!70, inner sep=0pt, minimum size=1.5mm}]

    \node[roundnode,label=right:{$u^{}_1$}] at (1,0) (u1) {};
    \node[roundnode,label=above right:{$u^{}_2$}] at (0.78539816339,0.70710678118) (u2) {};
    \node[roundnode,label=:{$u^{}_3$}] at (0,1) (u3) {};
    \node[roundnode,label=above left:{$u^{}_4$}] at (-0.78539816339,0.70710678118) (u4) {};
    \node[roundnode,label=left:{$u^{}_5$}] at (-1,0) (u5) {};
    \node[roundnode,label=left:{$u^{}_6$}] at (-0.78539816339,-0.70710678118) (u6) {};
    \node[roundnode,label=below:{$u^{}_7$}] at (0,-1) (u7) {};
    \node[roundnode,label=below right:{$u^{}_n$}] at (0.78539816339,-0.70710678118) (un) {};

    \draw[-] (un) -- (u1) -- (u2) -- (u3) -- (u4) -- (u5) -- (u6) -- (u7);
\end{tikzpicture}  
\end{document}

答案1

比 nidhin 的解决方案稍微复杂一点,添加\usetikzlibrary{calc}并使用

\foreach \i in {0.25,0.5,0.75}
    \fill ($(un)!\i!(u7)$) circle[radius=1pt];

在此处输入图片描述

\documentclass[12pt]{article}    
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}  
\begin{tikzpicture}[roundnode/.style={circle, fill=black!70, inner sep=0pt, minimum size=1.5mm}]

    \node[roundnode,label=right:{$u^{}_1$}] at (1,0) (u1) {};
    \node[roundnode,label=above right:{$u^{}_2$}] at (0.78539816339,0.70710678118) (u2) {};
    \node[roundnode,label=:{$u^{}_3$}] at (0,1) (u3) {};
    \node[roundnode,label=above left:{$u^{}_4$}] at (-0.78539816339,0.70710678118) (u4) {};
    \node[roundnode,label=left:{$u^{}_5$}] at (-1,0) (u5) {};
    \node[roundnode,label=left:{$u^{}_6$}] at (-0.78539816339,-0.70710678118) (u6) {};
    \node[roundnode,label=below:{$u^{}_7$}] at (0,-1) (u7) {};
    \node[roundnode,label=below right:{$u^{}_n$}] at (0.78539816339,-0.70710678118) (un) {};

    \draw[-] (un) -- (u1) -- (u2) -- (u3) -- (u4) -- (u5) -- (u6) -- (u7);

    \foreach \i in {0.25,0.5,0.75}
        \fill ($(un)!\i!(u7)$) circle[radius=1pt];

\end{tikzpicture}  
\end{document}

答案2

dotted线是制作此图片的一种方法。(提到了安德鲁·斯旺也。)这样你还可以吗?

在此处输入图片描述

\documentclass[12pt]{article}    
\usepackage{tikz}  
\begin{document}  
\begin{tikzpicture}[roundnode/.style={circle, fill=black!70, inner sep=0pt, minimum size=1.5mm}]

    \node[roundnode,label=right:{$u^{}_1$}] at (1,0) (u1) {};
    \node[roundnode,label=above right:{$u^{}_2$}] at (0.78539816339,0.70710678118) (u2) {};
    \node[roundnode,label=:{$u^{}_3$}] at (0,1) (u3) {};
    \node[roundnode,label=above left:{$u^{}_4$}] at (-0.78539816339,0.70710678118) (u4) {};
    \node[roundnode,label=left:{$u^{}_5$}] at (-1,0) (u5) {};
    \node[roundnode,label=left:{$u^{}_6$}] at (-0.78539816339,-0.70710678118) (u6) {};
    \node[roundnode,label=below:{$u^{}_7$}] at (0,-1) (u7) {};
    \node[roundnode,label=below right:{$u^{}_n$}] at (0.78539816339,-0.70710678118) (un) {};

    \draw[-] (un) -- (u1) -- (u2) -- (u3) -- (u4) -- (u5) -- (u6) -- (u7);
    \draw[loosely dotted,thick] (un)--(u7);
\end{tikzpicture}  
\end{document}

相关内容