# Individual value labels in Kiviat Diagram

I'm using the tkz-kiviat package to draw spider graphs and am quite happy with it. I can see how to add a axis label but how can I label the individual values of each node? There doesn't seem to be a solution to this in the documentation...

I'm trying to add the specific values to the balls.

\documentclass[]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[upright]{fourier}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-kiviat,numprint,fullpage}
\usetikzlibrary{arrows}
\thispagestyle{empty}

\begin{document}

\begin{tikzpicture}[label distance=.15cm]

{Poissons,Légumes,Viande,Lait,Pain}

\tkzKiviatLine[thick,color=red,mark=ball,  ball color=red,mark size=4pt,fill=red!20](5,9,6,8,4)

\tkzKiviatLine[thick,color=blue,mark=ball,mark size=4pt,fill=blue!20,opacity=.5](9,6,8,4,5)

\end{tikzpicture}
\end{document}


This answer is not using the tkz-kiviat but still it does what it is supposed to do (without requiring additional packages). You have to manually indicate the number of axes as well as the positions of the nodes, and of course your label.

\documentclass[]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[upright]{fourier}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-kiviat,numprint,fullpage}
\usetikzlibrary{arrows}
\thispagestyle{empty}

\begin{document}

\begin{tikzpicture}[label distance=.15cm]

{Poissons,Légumes,Viande,Lait,Pain}

\tkzKiviatLine[thick,color=red,mark=ball,  ball color=red,mark size=4pt,fill=red!20](5,9,6,8,4)

\tkzKiviatLine[thick,color=blue,mark=ball,mark size=4pt,fill=blue!20,opacity=.5](9,6,8,4,5)

% the distance between two grid lines is 0.5
%we have 5 axis so the angle between two axis is 360/5 = 72
\def\noaxes{5}
\def\ang{(360/\noaxes)};

\draw ((2.5,0)node[anchor=south] {a1};
\draw ((4.5,0)node[anchor=south] {a2};

% e.g. 9 is the position of the node
\draw ((9*cos{\ang}/2,9*sin{\ang}/2)node[anchor=south] {b1};
\draw ((6*cos{\ang}/2,6*sin{\ang}/2)node[anchor=south] {b2};

\draw ((6*cos{(2*\ang)}/2,6*sin{(2*\ang)}/2)node[anchor=south] {c1};
\draw ((8*cos{(2*\ang)}/2,8*sin{(2*\ang)}/2)node[anchor=south] {c2};

\draw ((8*cos{(3*\ang)}/2,8*sin{(3*\ang)}/2)node[anchor=south] {d1};
\draw ((4*cos{(3*\ang)}/2,4*sin{(3*\ang)}/2)node[anchor=south] {d2};

\draw ((4*cos{(4*\ang)}/2,4*sin{(4*\ang)}/2)node[anchor=south] {e1};
\draw ((5*cos{(4*\ang)}/2,5*sin{(4*\ang)}/2)node[anchor=south] {e2};

\end{tikzpicture}
\end{document}


Alternatively you can also include the following \newcommand

 \newcommand{\annotMark}[5]{
%can be called with \annotMark{<noaxis>}{<angle>}{<"ccordinate">}{<gap>}{<lable>}; stadart value for gap (i.e. gap is not specified =0.5}
\pgfmathsetmacro{\xcor}{#3*cos{(#1*#2)}/(1/#4)};
\pgfmathsetmacro{\ycor}{#3*sin{(#1*#2)}/(1/#4)};
\draw (\xcor,\ycor)node[anchor=south]{#5};
}


and make the annotations by calling this command (this example is for the b1 annotation)

\annotMark{1}{\ang}{9}{0.5}{b1};


This command is also capable of handling different grid-sizes (gap)

To make it clear, the number of radials determines the size of the angle \ang (e.g. if you have two radials \ang = 180 deg )

As you can see in the MWE I used the following code for this

 \def\noaxes{<number of radials>}
\def\ang{(360/\noaxes)};


Thus this code works for any number of radials. You only have to use the \annotMark{1}{\ang}{<position>}{<gap>}{<label>} for each marker you have.

• Thanks for the reply, Zwähnia! I will go with that, if there's no simpler solution. – Tom Bow Jun 14 '13 at 6:54
• @TomBow I rewrote the code in form of a \newcommand, maybe you find the result simpler? (In addition the code can now also handle variable grid sizes) – Zwähnia Jun 14 '13 at 12:07
• Hi Zwähnia Thanks even more! Your solution is probably worth publishing somewhere more accessible for users of this kind of graphs! I am still struggling figuring out how your solution works, exactly, though (it has been a while since my last geometry classes in high school...). Is it easily adaptable for graphs with 3 or 4 radials? I will post the code of a graph I'm thinking about. – Tom Bow Jun 15 '13 at 6:27
• Alright, I understood how I can make the same for a simpler 4 ray graph. Posting the solution. – Tom Bow Jun 15 '13 at 7:03
• @TomBow my solution works for any number of radials. You only have to tell the code how many radials you have and then the code will adapt the angle between the radials. You only have to replace the 5 in \def\noaxes{5} by the number of radials you have! – Zwähnia Jun 15 '13 at 20:43

Thanks a lot to Zwähnia for his code

I tried to adapt it to a 4 ray graph with the following solution (if someone wants to do the same).

\begin{tikzpicture}
\tkzKiviatDiagram[scale=0.4,label distance=1cm,
gap     = 1,
label space = 2.5,
lattice = 5]
{Raw Materials,Labour,Capital, Energy}
\tkzKiviatLine[thick,color=blue,mark=ball,
ball color=blue,mark size=3pt,fill=blue!100](3,4,2,4)
\node[anchor=south west,xshift=-60pt,yshift=40pt] at (current bounding box.south east)
{
\begin{tabular}{@{}lp{10cm}@{}}

\textcolor{blue!100}{\rule{2ex}{2ex}} & Inputs requirements \\
\end{tabular}
};

\draw ((0.5,4)node[anchor=south] {4};
\draw ((3.5,0)node[anchor=south] {3};
\draw ((0.5,-5.5)node[anchor=south] {4};
\draw ((-2.5,0)node[anchor=south] {2};

\end{tikzpicture}


Output http://img843.imageshack.us/img843/2057/2fi9.jpg