8

I'm able to draw radar chart using tex code mentioned below:

\documentclass[landscape,a3paper,11pt]{article}
\usepackage{pstricks-add}
\usepackage{pgfplots, pgfplotstable}
\begin{document}
\begin{center}
\begin{pspicture}(-5,-5)(5,5)
\psset{unit=1.2}
\psaxes[labels=none,axesstyle=polar,ticklinestyle=dashed,tickcolor=black!40](0,0)(-4,-4)(4,4)
\psaxes[dx=1,dy=1,Dx=25,Dy=25](0,0)(0,0)(4,4)%
\psxTick{0}(-1){25}
\psxTick{0}(-2){50}
\psxTick{0}(-3){75}
\psxTick{0}(-4){100}
\psyTick{0}(-1){25}
\psyTick{0}(-2){50}
\psyTick{0}(-3){75}
\psyTick{0}(-4){100}
\psset{fillstyle=solid,opacity=0.5}
\pswedge[fillcolor=black!10]{1}{0}{36}
\pswedge[fillcolor=black!20]{2}{36}{72}
\pswedge[fillcolor=black!30]{1}{72}{108}
\pswedge[fillcolor=black!40]{2}{108}{144}
\pswedge[fillcolor=black!50]{1}{144}{180}
\pswedge[fillcolor=black!60]{2}{180}{216}
\pswedge[fillcolor=black!70]{1}{216}{252}
\pswedge[fillcolor=black!80]{2}{252}{288}
\pswedge[fillcolor=black!90]{1}{288}{324}
\pswedge[fillcolor=black]{1}{324}{360}
\rput(4.9;18){Skill1}
\rput(4.9;54){Skill2}
\rput(4.9;90){Skill3}
\rput(4.9;126){Skill4}
\rput(4.9;162){Skill5}
\rput(4.9;198){Skill6}
\rput(4.9;234){Skill7}
\rput(4.9;270){Skill8}
\rput(4.9;306){Skill9}
\rput(4.9;342){Skill10}
\psset{opacity=1}
\end{pspicture}
\end{center}
\end{document}

Generated output is enter image description here

Default axis of RADAR chart is placed at interval of 30 degree [Marked in GREEN] There are 10 data points which is making angle of each pie as 36 [ie 360/10 Marked in RED]

Is there any way to change axis of RADAR chart to always conside with the axis of Datapoints? Expected axis is marked in GRAY Color

5

Set the unit to 300 degrees, but only for the axis. If you have several of such images then use an own macro \sectors{1,2,...} which needs only the given radius, the rest can be done by the macro itself:

\documentclass{article}
\usepackage{pstricks-add}
\newcounter{CValue}\newcounter{GValueA}
\makeatletter
\def\sectors#1{%
  \begin{pspicture}(-5,-5)(5,5)
  \psset{unit=1.2cm}%
  \degrees[300]%
  \psaxes[labels=none,axesstyle=polar,ticklinestyle=dashed,tickcolor=black!40](0,0)(-4,-4)(4,4)
  \psaxes[dx=1,dy=1,Dx=25,Dy=25](0,0)(0,0)(4,4)%
  \degrees[360]%
  \multido{\iA=-4+1,\iB=100+-25}{4}{\psxTick{0}(\iA){\iB}\psyTick{0}(\iA){\iB}}%
  \psset{fillstyle=solid,opacity=0.5}%
  \multido{\iA=18+36,\iB=1+1}{10}{\rput(4.9;\iA){Skill\iB}}%
  \setcounter{CValue}{10}\setcounter{GValueA}{0}%
  \expandafter\sectors@i#1,,\@nil
  \end{pspicture}}
\def\sectors@i#1,#2,#3\@nil{%
  \pswedge[fillcolor=black!\theCValue]{#1}{\theGValueA}{! \theGValueA\space 36 add}%
  \ifx\relax#2\relax \else
    \addtocounter{CValue}{10}\addtocounter{GValueA}{36}%
    \sectors@i#2,#3\@nil\fi}
\makeatother
\begin{document}

\begin{center}
\sectors{1,2,1,2,1,2,1,2,1,1}
%
\sectors{1,2,3,2,1,2,3,2,1,2}
\end{center}
\end{document}

enter image description here

And a solution for 9 elements. The changes can be done inside the macro, if you need it often. However, here it is with changing the values 300->270 and 36->40:

\documentclass{article}
\usepackage{pstricks-add}
\newcounter{CValue}\newcounter{GValueA}
\makeatletter
\def\sectors#1{%
  \begin{pspicture}(-5,-5)(5,5)
  \psset{unit=1.2cm}%
  \degrees[270]%
  \psaxes[labels=none,axesstyle=polar,ticklinestyle=dashed,tickcolor=black!40](0,0)(-4,-4)(4,4)
  \psaxes[dx=1,dy=1,Dx=25,Dy=25](0,0)(0,0)(4,4)%
  \degrees[360]%
  \multido{\iA=-4+1,\iB=100+-25}{4}{\psxTick{0}(\iA){\iB}\psyTick{0}(\iA){\iB}}%
  \psset{fillstyle=solid,opacity=0.5}%
  \multido{\iA=18+40,\iB=1+1}{9}{\rput(4.9;\iA){Skill\iB}}%
  \setcounter{CValue}{10}\setcounter{GValueA}{0}%
  \expandafter\sectors@i#1,,\@nil
  \end{pspicture}}
\def\sectors@i#1,#2,#3\@nil{%
  \pswedge[fillcolor=black!\theCValue]{#1}{\theGValueA}{! \theGValueA\space 40 add}%
  \ifx\relax#2\relax \else
    \addtocounter{CValue}{10}\addtocounter{GValueA}{40}%
    \sectors@i#2,#3\@nil\fi}
\makeatother
\begin{document}

\begin{center}
\sectors{1,2,1,2,1,2,1,2,1}
%
\sectors{1,2,3,2,1,2,3,2,1,2}
\end{center}
\end{document}

enter image description here

And here the solution for your code if you do not want to modify it:

\documentclass[landscape,a3paper,11pt]{article}
\usepackage{pstricks-add}
\usepackage{pgfplots, pgfplotstable}
\begin{document}
\begin{center}
\begin{pspicture}(-5,-5)(5,5)
\psset{unit=1.2}
\degrees[300]
\psaxes[labels=none,axesstyle=polar,ticklinestyle=dashed,tickcolor=black!40](0,0)(-4,-4)(4,4)
\psaxes[dx=1,dy=1,Dx=25,Dy=25](0,0)(0,0)(4,4)%
\degrees[360]
\multido{\iA=-4+1,\iB=100+-25}{4}{\psxTick{0}(\iA){\iB}\psyTick{0}(\iA){\iB}}
\psset{fillstyle=solid,opacity=0.5}
\pswedge[fillcolor=black!10]{1}{0}{36}
\pswedge[fillcolor=black!20]{2}{36}{72}
\pswedge[fillcolor=black!30]{1}{72}{108}
\pswedge[fillcolor=black!40]{2}{108}{144}
\pswedge[fillcolor=black!50]{1}{144}{180}
\pswedge[fillcolor=black!60]{2}{180}{216}
\pswedge[fillcolor=black!70]{1}{216}{252}
\pswedge[fillcolor=black!80]{2}{252}{288}
\pswedge[fillcolor=black!90]{1}{288}{324}
\pswedge[fillcolor=black]{1}{324}{360}
\multido{\iA=18+36,\iB=1+1}{10}{\rput(4.9;\iA){Skill\iB}}
\end{pspicture}
\end{center}
\end{document}
4
  • Thank You Herbert for providing answer & alternate solution.
    – Pawan Mude
    Nov 15 '13 at 5:51
  • I'm testing this solution for multiple combination of data points, for total 9 data points, I've considered angle as 270 ; is it correct?
    – Pawan Mude
    Nov 15 '13 at 9:51
  • 1
    should the 9 data points have an angle of 40 degrees or still 36? If they are together 360 then replace the value 36 in the code of \sectors@i with 40
    – user2478
    Nov 15 '13 at 11:19
  • Yes... Thank You; I've replaced \degrees[300] with \degrees[270] and still testing for other test cases..
    – Pawan Mude
    Nov 15 '13 at 13:44
4
\documentclass[pstricks,border=13mm,11pt]{standalone}
\usepackage{pst-plot}


\begin{document}
\makeatletter
\begin{pspicture}(-5,-5)(5,5)
\psset{unit=1.2,labels=none}
\degrees[300]
\psaxes[axesstyle=polar,ticklinestyle=dashed,tickcolor=black!40](0,0)(-4,-4)(4,4)
\degrees[360]
\multido{\i=-4+1}{9}{%
    \ifnum\i>0\relax \edef\c{1} \else \edef\c{-1} \fi
    \edef\lbl{\the\numexpr\c*25*\i\relax}%
    \psxTick{0}(\i){\lbl}
    \psyTick{0}(\i){\lbl}
}
\psaxes[ticks=none](0,0)(-4,-4)(4,4)
\psset{fillstyle=solid,opacity=0.5}
\multido{\iA=0+36,\iB=36+36,\iC=10+10}{9}{%
    \pst@mod{\iC}{20}\rem
    \pswedge[fillcolor=black!\iC]{\ifnum\rem=0 2\else 1\fi}{\iA}{\iB}
}
\pswedge[fillcolor=black]{1}{324}{360}
\multido{\iA=18+36,\iB=1+1}{10}{\rput(4.9;\iA){Skill\iB}}
\end{pspicture}
\makeatother
\end{document}

enter image description here

3
  • Thank You Donut for providing answer. It's working perfectly.
    – Pawan Mude
    Nov 15 '13 at 5:46
  • 1
    @PawanMude: If you like this answer, please kindly to accept it and optionally vote it up. :-) Thanks! Nov 15 '13 at 6:19
  • Sir I've already voted it up... I'm testing solution for multiple combinations. If there are 9 data points, i've considered angle as 270; Is it correct?
    – Pawan Mude
    Nov 15 '13 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.