# Kiviat diagram with axis labeled and different sizes

I am trying to use the package tkz-kiviat to draw a kiviat. The following example produces the image below:

\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}
\tkzKiviatDiagram[scale=1.25,label distance=.5cm,
gap     = 1,
\tkzKiviatLine[thick,color=blue,mark=none,
fill=blue!20,opacity=.5](3,3.5,3,3.5,3)
\tkzKiviatLine[thick,color=darkgray,
fill=green!20,opacity=.5](0.5,1,0.5,0.75,1)
\tkzKiviatLine[ultra thick,mark=ball,
mark size=4pt,color =Maroon](2,3.75,1,1.5,2)
\end{tikzpicture}

\end{document}


My questions are:

1. Is it possible to have axes with different sizes? In the previous example, all the axes go from 0 to 5. I would like to have one axis from 0 to 3, other from 0 to 2, and so on.
2. Is it possible to label the axes with enumerated values? In the previous example, instead of having 100€, 200€, etc. I would like to have Axis1: Active, Passive. Axis2: Earth, Venus, Sun, ...

Is this possible with this pacakge? Do I need to use another one?

-
Welcome to TeX.SX! No need to end your post with a 'Thank you'. It is our way of keeping things concise. If you want to thank someone, upvote (and accept) his/her answer. :) – Count Zero May 29 '12 at 9:09
Different axis lengths damage the visual info that Kiviat charts offer. You won't be able to compare the emphasis on different parts of the chart. – percusse May 29 '12 at 9:41
I agree, but I have different axes with different sizes. How can I compare the information if it is not with a "kiviat approach"? If you have other solutions, they are more than welcome. I think having a kiviat with different axes is not that bad for my particular case. – DConversor May 29 '12 at 9:46
You can still scale the intervals such that they look equal maybe? Can you include in the question what the precise application is? – percusse May 29 '12 at 10:48
Probably scaling is a good idea, once we know how to use different sizes for each axes. So the shape of the kiviat diagram can be uniform / regular (hexagon, pentagon, etc.) The exact application is a taxonomy classification. Different systems are classified into this taxonomy. As I have more than three axis, I thought of kiviat diagrams. However, my axis have all not an equal "size", i.e., number of values a system can have for a given axes. – DConversor May 29 '12 at 11:38

An example for my alternate approach with TikZ nodes:

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usepackage{xifthen}
\usepackage{wasysym}

\newcommand{\myshape}{circle}
\newcommand{\myfillcolor}{white}
\newcommand{\mydrawcolor}{black}
\newcommand{\myfontcolor}{black}
\newcommand{\mynodecontent}{black}

\newcommand{\multiscale}[2]{% mode, planet
\ifthenelse{\equal{#1}{passive}}{\renewcommand{\mydrawcolor}{green!70!blue}}{}
\ifthenelse{\equal{#1}{active}}{\renewcommand{\mydrawcolor}{red!80!yellow}}{}
% ---------
\node[color=-\mydrawcolor,draw=\mydrawcolor,fill=\myfillcolor,circle,ultra thick,minimum size=1cm] {\textbf{\mynodecontent}};
}

\begin{document}

\begin{tikzpicture}
\multiscale{passive}{Mercury}
\end{tikzpicture}
\begin{tikzpicture}
\multiscale{passive}{Venus}
\end{tikzpicture}
\begin{tikzpicture}
\multiscale{passive}{Earth}
\end{tikzpicture}

\begin{tikzpicture}
\multiscale{active}{Mercury}
\end{tikzpicture}
\begin{tikzpicture}
\multiscale{active}{Venus}
\end{tikzpicture}
\begin{tikzpicture}
\multiscale{active}{Earth}
\end{tikzpicture}

\end{document}


In this case, passive is green frame, active is red frame, and the planets become lighter gray outwards from the sun. Of course, you'd have to provide a nice key for explanation.

Edit 1: I've had a look at the documentation of tkz-kiviat and as far as I can see it is not possible. I made a little concept how it might work, but it need horribly much manual tweaking. Also, i have no idea about text labels as pgfmath can only extract numbers from array like structures. Probably you can also ask Altermundus, the author of tkz-kiviat and also a user on this site.

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}

\newcommand{\kivaxisnumbers}{3}
\newcommand{\kivcategorycounts}{{2,3,4}}
\newcommand{\kivkumulativecategorycounts}{{0,2,5}}
\newcommand{\kivcategorynames}{{1,2,10,20,30,100,200,300,400}}
\newcommand{\kivlcmcatcount}{12}

\newcommand{\kivlattice}{%
\pgfmathsetmacro{\kivaxisangle}{360/\kivaxisnumbers}
\foreach \x in {1,...,\kivaxisnumbers}
{   \foreach \y in {1,...,\kivlcmcatcount}
{   \pgfmathsetmacro{\kivaxisstep}{6/\kivlcmcatcount}
\draw[help lines] (\kivaxisangle*\x:\y*\kivaxisstep) -- (\kivaxisangle*\x+\kivaxisangle:\y*\kivaxisstep);
}
}
\foreach \x in {1,...,\kivaxisnumbers}
{   \draw[->] (0,0) -- (\kivaxisangle*\x:6cm);
\pgfmathsetmacro{\kivaxissteps}{\kivcategorycounts[\x-1]}
\pgfmathsetmacro{\kivaxisstep}{6/\kivcategorycounts[\x-1]}
\foreach \y in {1,...,\kivaxissteps}
{   \pgfmathsetmacro{\kivhelper}{\kivkumulativecategorycounts[\x-1]}
\pgfmathtruncatemacro{\kivlabelname}{\kivcategorynames[\kivhelper+\y-1]}
\node[circle,fill=black,label=\x*\kivaxisangle+90:\kivlabelname,inner sep=1pt] at (\kivaxisangle*\x:\kivaxisstep*\y) {};
}
}

}

\begin{document}

\begin{tikzpicture}
\kivlattice
\end{tikzpicture}

\end{document}


Edit 2: For adding some data (in percentages of the axes):

\newcommand{\kivdatapoints}{}

\newcommand{\kivdata}[2]{% values in percentages of max, color
\renewcommand{\kivdatapoints}{{#1}}
\pgfmathsetmacro{\kivaxisangle}{360/\kivaxisnumbers}
\pgfmathsetmacro{\kivcoordinate}{\kivdatapoints[0]*6}
\fill[opacity=0.2,#2] (\kivaxisangle:\kivcoordinate)
\foreach \x in {1,...,\kivaxisnumbers}
{   %\pgfmathsetmacro{\kivcoordinate}{\kivdatapoints[\x-1]*6}
-- (\kivaxisangle*\x:\kivdatapoints[\x-1]*6)
}
-- cycle;
}

\begin{document}

\begin{tikzpicture}
\kivlattice
\kivdata{0.2,0.9,0.6}{red}
\kivdata{0.7,0.1,0.8}{green}
\kivdata{0.4,0.35,0.3}{blue}
\end{tikzpicture}


Edit 3: Thanks to Brandon Kuczenski's answer in this question, I was able to add text labels to the axes:

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usepackage{arrayjobx}

\makeatletter
\usepackage{trimspaces}
\def\trimspace#1{\trim@spaces@in{#1}}
\makeatother

\newarray\kivaxisitemlabels
Decision  & Yes    & No     &        &       &
Color     & Red    & Blue   & Yellow &       &
Direction & North  & East   & South  & West  &
Taste     & Sour   & Salty  & Bitter & Sweet &
World     & Normal & Nether & End    &       }
\dataheight=5

\newcommand{\kivcurrentlabel}[2]{\checkkivaxisitemlabels(#1,#2)\trimspace\cachedata \cachedata}

\newcommand{\kivaxisnumbers}{5}
\newcommand{\kivcategorycounts}{{2,3,4,4,3}}
\newcommand{\kivkumulativecategorycounts}{{0,2,5,9,13}}
%\newcommand{\kivcategorynames}{{1,2,10,20,30,100,200,300,400}}
\newcommand{\kivlcmcatcount}{12}

\newcommand{\kivlattice}{%
\pgfmathsetmacro{\kivaxisangle}{360/\kivaxisnumbers}
\foreach \x in {1,...,\kivaxisnumbers}
{   \foreach \y in {1,...,\kivlcmcatcount}
{   \pgfmathsetmacro{\kivaxisstep}{6/\kivlcmcatcount}
\draw[help lines] (\kivaxisangle*\x:\y*\kivaxisstep) -- (\kivaxisangle*\x+\kivaxisangle:\y*\kivaxisstep);
}
}
\foreach \x in {1,...,\kivaxisnumbers}
{   \draw[->] (0,0) -- (\kivaxisangle*\x:6cm);
\pgfmathsetmacro{\kivaxissteps}{\kivcategorycounts[\x-1]}
\pgfmathsetmacro{\kivaxisstep}{6/\kivcategorycounts[\x-1]}
\foreach \y in {1,...,\kivaxissteps}
{   %\pgfmathsetmacro{\kivhelper}{\kivkumulativecategorycounts[\x-1]}
%\pgfmathtruncatemacro{\kivlabelname}{\kivcategorynames[\kivhelper+\y-1]}
%\node[circle,fill=black,label=\x*\kivaxisangle+90:\kivlabelname,inner sep=1pt] at (\kivaxisangle*\x:\kivaxisstep*\y) {};
\pgfmathtruncatemacro{\kivlabelnumber}{\y+1}
\node[circle,fill=black,label=\x*\kivaxisangle+90:\kivcurrentlabel{\x}{\kivlabelnumber},inner sep=1pt] at (\kivaxisangle*\x:\kivaxisstep*\y) {};
}
}
}

\newcommand{\kivdatapoints}{}

\newcommand{\kivdata}[2]{% values in percentages of max, color
\renewcommand{\kivdatapoints}{{#1}}
\pgfmathsetmacro{\kivaxisangle}{360/\kivaxisnumbers}
\pgfmathsetmacro{\kivcoordinate}{\kivdatapoints[0]*6}
\fill[opacity=0.2,#2] (\kivaxisangle:\kivcoordinate)
\foreach \x in {1,...,\kivaxisnumbers}
{   %\pgfmathsetmacro{\kivcoordinate}{\kivdatapoints[\x-1]*6}
-- (\kivaxisangle*\x:\kivdatapoints[\x-1]*6)
}
-- cycle;
}

\begin{document}

\begin{tikzpicture}
\kivlattice
\kivdata{0.2,0.9,0.6,0.5,0.5}{red}
\kivdata{0.7,0.1,0.8,0.6,.2}{green}
\kivdata{0.4,0.35,0.3,0.25,0.2}{blue}
\end{tikzpicture}

\end{document}


-
Sorry, but how does this answer the question? – Tobi May 29 '12 at 15:14
In my comment, I said that a Kiviat diagram might not be a good choice for his axes, so I provided a different approach. So no, I did not provide an answer solving his problem with Kiviat diagrams, but instead displaying the desired information in an alternative way. – Tom Bombadil May 29 '12 at 15:24
Thank’s :-) I’ll remove my comment … – Tobi May 29 '12 at 18:02
@Tobi: No need, it's a legitimate question. – Tom Bombadil May 29 '12 at 18:22
Ok thank I’ll keep it :-) – Tobi May 29 '12 at 18:33

I created tkz-kiviat to draw only kiviat diagram . i'm not a great expert with kiviat diagram but in your case, you don't get a kiviat diagram with your requests.

1) You need to use quantitative variables represented on axes starting from the same point.

2) The data length of a spoke is proportional to the magnitude of the variable for the data point relative to the maximum magnitude of the variable across all data points.

With the actual tkz-kiviat, the only possibility to modify axes, is to use percent with lattice=10. It's the better method to compare the values (kiviat diagram are used for this) and to compare areas. Only numeric values are used and authorized.

-
Thank you Altermundus. What I wanted is the kiviat drawn by Tom with qualitative values in the axes, with a different number of values by axis. – DConversor Jun 4 '12 at 5:14