我必须绘制一个完整的 5 太阳图和一个 5 横线图。我尝试绘制它们(代码如下)。但这并不准确

我必须绘制一个完整的 5 太阳图和一个 5 横线图。我尝试绘制它们(代码如下)。但这并不准确

在此处输入图片描述

\begin{tikzpicture}[xscale=1, yscale=1.8]
        \tikzstyle{every node}=[circle, fill=black!,inner sep=0pt, minimum
        width=5pt]
        \node (1) at (0,.65)[label=north east:{$x_1$}] {}; 
        \node (2) at (1.5,0)[label=south east:{$x_2$}] {}; 
        \node (3) at (1.05,-1)[label=right:{$x_3$}] {};
        \node (4) at (-1.05,-1)[label=left:{$x_4$}] {}; 
        \node (5) at (-1.5,0)[label=south west:{$x_5$}] {};
         \node(a) at (0,1.3)[label=north east:{$y_1$}] {}; 
        \node (b) at (2.6,0.2)[label=south east:{$y_2$}] {};
        \node (c) at (1.8,-1.5)[label=right:{$y_3$}] {}; 
        \node (d) at (-1.8,-1.5)[label=left:{$y_4$}] {}; 
        \node (e) at (-2.6,0.2)[label=south west:{$y_5$}] {}; 
        
        \foreach \from/\to in
        {1/2, 1/3, 1/4, 1/5, 2/3, 2/4, 2/5, 3/4, 3/5, 4/5, 1/a, 2/b, 3/c, 4/d, 5/e}\draw (\from) -- (\to);
    \end{tikzpicture}
\begin{tikzpicture}[scale=.5]
        \tikzstyle{every node}=[circle, fill=black!,inner sep=0pt, minimum width=2pt]
        

\node (1) at (0,0)[label=north east:{$x_1$}] {}; 
        \node (2) at (3.5,-2.2)[label=south east:{$x_2$}] {}; 
        \node (3) at (2.7,-6)[label=right:{$x_3$}] {};
        \node (4) at (-2.7,-6)[label=left:{$x_4$}] {}; 
        \node (5) at (-3.5,-2.2)[label=south west:{$x_5$}] {};
        \node(a) at (10,0)[label=north east:{$y_1$}] {}; 
        \node (b) at (13.5,-2.2)[label=south east:{$y_2$}] {};
        \node (c) at (12.7,-6)[label=right:{$y_3$}] {}; 
        \node (d) at (7.3,-6)[label=left:{$y_4$}] {}; 
        \node (e) at (6.5,-2.2)[label=south west:{$y_5$}] {}; 
        
        \foreach \from/\to in
        {1/2, 1/3, 1/4, 1/5, 2/3, 2/4, 2/5, 3/4, 3/5, 4/5,a/b,a/c,a/d,a/e,b/c,b/d,b/e,c/d,c/e,d/e,2/e}\draw (\from) -- (\to);
    \end{tikzpicture}

答案1

这应该非常准确:

\documentclass[12pt]{article}
\usepackage{tikz}

\begin{document}
\thispagestyle{empty} %Please, no page numbers or similar

\begin{tikzpicture}[xscale=1, yscale=1]
    \tikzstyle{every node}=[circle, fill=black!,inner sep=0pt, minimum width=5pt]
    \node (1) at (0:3)[label=north east:{$x_1$}] {}; 
    \node (2) at (72:3)[label=south east:{$x_2$}] {}; 
    \node (3) at (144:3)[label=right:{$x_3$}] {};
    \node (4) at (216:3)[label=left:{$x_4$}] {}; 
    \node (5) at (288:3)[label=south west:{$x_5$}] {};
    \node (a) at (0:5)[label=north east:{$y_1$}] {}; 
    \node (b) at (72:5)[label=south east:{$y_2$}] {};
    \node (c) at (144:5)[label=right:{$y_3$}] {}; 
    \node (d) at (216:5)[label=left:{$y_4$}] {}; 
    \node (e) at (288:5)[label=south west:{$y_5$}] {}; 
        
    \foreach \from/\to in {1/2, 1/3, 1/4, 1/5, 2/3, 2/4, 2/5, 3/4, 3/5, 4/5, 1/a, 2/b, 3/c, 4/d, 5/e}\draw (\from) -- (\to);
\end{tikzpicture}

\begin{tikzpicture}[xscale=1, yscale=1]
    \tikzstyle{every node}=[circle, fill=black!,inner sep=0pt, minimum width=5pt]
    \node (1) at (0:3)[label=north east:{$x_1$}] {}; 
    \node (2) at (72:3)[label=south east:{$x_2$}] {}; 
    \node (3) at (144:3)[label=right:{$x_3$}] {};
    \node (4) at (216:3)[label=left:{$x_4$}] {}; 
    \node (5) at (288:3)[label=south west:{$x_5$}] {};
    \node (a) at ([shift=(0:7)] 36:3)[label=north east:{$y_1$}] {}; 
    \node (b) at ([shift=(0:7)] 108:3)[label=south east:{$y_2$}] {};
    \node (c) at ([shift=(0:7)] 180:3)[label=right:{$y_3$}] {}; 
    \node (d) at ([shift=(0:7)] 252:3)[label=left:{$y_4$}] {}; 
    \node (e) at ([shift=(0:7)] 324:3)[label=south west:{$y_5$}] {}; 
        
    \foreach \from/\to in {1/2, 1/3, 1/4, 1/5, 2/3, 2/4, 2/5, 3/4, 3/5, 4/5}\draw (\from) -- (\to);
    \foreach \from/\to in {a/b, a/c, a/d, a/e, b/c, b/d, b/e, c/d, c/e, d/e}\draw (\from) -- (\to);
    \draw (1) -- (c);
\end{tikzpicture}

\end{document}

(a:b) 符号是一种极坐标(角度:距离)。

相关内容