6

I have 5 properties and I thought that visualizing them along the axis of a pentagon would be nice. The properties can take an integer value between 0-5. Together that span a surface within the pentagon.

This is what I'd would like the image to look like [took me forever to make the markers in inkscape :-)] :

enter image description here

This is what I have so far:

\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}

Resulting in this:

enter image description here

I'm lost at drawing the markers on the vertexes and having them equally spaces and equally lost when it comes to filling the polygon given by the 5 integer-values

Since I have quite a few of these to draw, making the above into a macro would be really nice :-)

Fredrik Pihl
  • 235
  • 1
  • 7

1 Answers1

3

Here's a manual implementation using pstricks. As such, compile with either LaTeX or XeLaTeX:

enter image description here

\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>} plots a polygon containing the values of properties <p1>, <p2>, <p3>, <p4> and <p5> with options <options>.

You could add multiple \proppolys on top of one another:

enter image description here

...
\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}
...
Werner
  • 603,163