[Tex/LaTex] Automatic scaling of kiviat diagrams

scalingtkz-kiviat

\documentclass[twoside,a4paper,12pt]{article}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage[upright]{fourier}
\usepackage{tkz-kiviat,numprint,fullpage}
\usetikzlibrary{arrows}
\usepackage{polyglossia}
\setmainlanguage{magyar}
\begin{document}


\begin{tikzpicture}
\tkzKiviatDiagram[label distance=.5cm, scale=0.3]{Introvertált,Oldott,Extrovertált,Feszült}
\tkzKiviatLine[thick,color=blue,mark=none,
               fill=blue!20,opacity=.5](
        37.5,
        50.0,
        13.3333333333,
        10.5263157895
    )
\tkzKiviatGrad[prefix=,unity=10,suffix=\ \%](1)
\end{tikzpicture}

\end{document}

Result:

enter image description here

For some reason, the 100% value in the lattice looks smaller than value=50. I could not find out how to adjust the diagram so that data remains inside the axes.

Another question: if I don't scale the whole diagram by 0.3, then it goes off the page. Why is that? Is it possible to adjust the diagram to textwidth of the current page?

Best Answer

You can find a french (sorry) documentation here

The number of latices is determined by an option : lattice. By default the number of lattices is 10. You need to use number between 0 and 10 to draw a kiviat line if you keep the default number. The number determines the lattice, for example you can use 20 lattices :

\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} [scale=.5]
   \tkzKiviatDiagram[lattice=20]{A,B,C,D,E} 
   \tkzKiviatLine[thick,
                  color      = blue,
                  mark       = ball,
                  mark size  = 4pt,
                  fill       = blue!20,
                  opacity=.5](4,3,20,15,10)
\end{tikzpicture} 
\end{document} 

enter image description here

But I think it's preferable to keep 10 in a great majority of cases. If you have 5 lattices, you need to use numbers between 0 and 5.

Update

With two grades :

\begin{tikzpicture}
\tkzKiviatDiagram[scale   = .6,
                  gap = 1,
                  lattice = 5]{%
McCabe,LOC,Live Variables,Halstead N,Variablenspanne}
\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)
\tkzKiviatGrad[prefix=,unity=100,suffix=\ \texteuro](1) 

\tkzKiviatGrad[prefix=,unity=20,suffix=\ \%](3)  
\end{tikzpicture}

enter image description here

It's also possible to use tikz to create a diagram but you need to look at the code to know some coordinates used in the drawing. it's possible !