在五邊形內繪製多邊形表面

在五邊形內繪製多邊形表面

我有 5 個屬性,我認為沿著五邊形的軸可視化它們會很好。這些屬性可以採用 0-5 之間的整數值。它們一起跨越五邊形內的一個表面。

這就是我希望圖像看起來的樣子 [我花了很長時間在 inkscape 中製作標記:-)]:

在此輸入影像描述

這是我到目前為止所擁有的:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}

\begin{tikzpicture}
\newdimen\R
\R=4cm
\node[draw=black, minimum size=\R,regular polygon,regular polygon sides=5] (a) {};
\draw (a.center) -- (a.north)    node[above] {Property1};
\draw (a.center) -- (a.corner 5) node[right] {Property2};
\draw (a.center) -- (a.corner 4) node[right] {Property3};
\draw (a.center) -- (a.corner 3) node[left]  {Property4};
\draw (a.center) -- (a.corner 2) node[left]  {Property5};

\draw [thin,black!20] circle (\R) ;
\fill[red] circle (2pt);

% Trial/error for this example
%                              P1        P2           P3              P4             P5
\draw[fill=cyan, opacity=0.8] (0,1.5) -- (0.9,0.3) -- (0.55, -0.8) -- (-0.6,-0.8) -- (-1.4,0.45) -- cycle;

\end{tikzpicture}

\end{document}

結果是這樣的:

在此輸入影像描述

當涉及到填充由 5 個整數值給出的多邊形時,我迷失了在頂點上繪製標記並使它們具有相同的空間和相同的丟失

因為我有很多要畫的東西,所以將上面的內容製作成宏會非常好:-)

答案1

這是一個使用手動實現pstricks。因此,使用 LaTeX 或 XeLaTeX 進行編譯:

在此輸入影像描述

\documentclass{article}
\usepackage{pstricks}% http://tug.org/PSTricks/main.cgi/
\usepackage{multido,xcolor}% http://ctan.org/pkg/{multido,xcolor}

\newcommand{\proppoly}[6][]{
  \pspolygon[fillstyle=solid,fillcolor=cyan,opacity=0.8,#1]%
    (#2;90)(#3;162)(#4;234)(#5;306)(#6;18)% Property polygon
}

\begin{document}

\begin{pspicture}(-5,-5)(5,5)
  \SpecialCoor% Allow for polar coordinate specifications
  \psset{runit=3cm,linewidth=.5pt}
  \pscircle[linecolor=black!20](0,0){1.2}% Outer circle

  \psset{linecolor=black!50}
  \multido{\iA=1+1,\iB=90+72}{5}{
    \psline(0,0)(1;\iB)% Radial line outward
    \multido{\rC=0.2+0.2}{4}{%
      \rput{\number\numexpr\iB+90\relax}(\rC;\iB){\psline(-2pt,0)(2pt,0)}}% Ticks are 4pt in length
    \rput{0}(1.1;\iB){\iA}% Property #s
  }

  \pspolygon(1;90)(1;162)(1;234)(1;306)(1;18)% Outer pentagon

  \proppoly{0.8}{0.87654}{0.4765}{0.55}{0.314}
\end{pspicture}

\end{document}

\proppoly[<options>]{<p1>}{<p2>}{<p3>}{<p4>}{<p5>}<p1>繪製一個包含屬性、<p2><p3><p4>以及<p5>選項值的多邊形<options>

您可以將多個\proppolys 相互疊加:

在此輸入影像描述

...
\proppoly{0.8}{0.87654}{0.4765}{0.55}{0.314}
\proppoly[fillcolor=green!30!yellow]{0.4}{0.5}{0.7}{0.9}{1}
\proppoly[fillcolor=red!70,opacity]{0.2}{0.3}{0.2}{0.3}{0.2}
...

相關內容