*! version 1.0 6 Dec 2021

Title

radar -- Radar plots or Spider plots

Syntax

radar
[varlist]
[if]
[in]
[,
options]

Optional
lc(string asis) the string argument is a colorstylelist and specifies the colors for the observations (not axes).

lp(string) the string argument is a linepatternstylelist and specifies the patterns for the observations (not axes).

lw(string) the string argument is a linewidthstylelist and specifies the line widths for the observations (not axes).

msize(string) the string argument is a markersizestylelist and specifies the size of the marker symbols to use for observations (not axes).

ms(string) the string argument is a symbolstylelist and specifies the marker symbols to use for observations BUT must be used in conjunction with the connected option (not axes).

mcolor(string) the string argument is a symbolstylelist and specifies the marker colors to use for observations BUT must be used in conjunction with the connected option (not axes).

rlabel(numlist) specifies the ticks and labels of the spokes.

labsize(string) the string argument is a textsizestyle and specifies the text size of the node labels (not axes).

radial(varname) specifies a variable to be plotted as spikes along the spokes of the plot.

axelaboff specifies that axes labels are removed.

axelc(string) the string argument is a colorlist and specifies the colors for the axes.

axelw(string) the string argument is a linewidthlist and specifies the line widths for the axes.

axelp(string) the string argument is a patternlist and specifies the patterns for the axes.

connected specifies that rather than a line graph of observations but a connected line graph is drawn.

* additional twoway_options can be specified, for example titles() and notes(), but not every possible option is allowed.

Description

radar produces a radar plot from at least two variables. The first variable must always contain the label for the axes
and the second variable must be numeric.

The axes of the radar plot will start at the top of the diagram and proceed in a clockwise direction. With the above dataset
the first axes will be labelled beer.

Missing values are included in the radar plot as gaps in the line joining observations.
This option is implemented using the cmiss(n) option of the twoway line graph, see help connect_options.

Options

Main

lc(string asis) the string argument is a colorstylelist and specifies the colors for the observations (not axes).

lp(string) the string argument is a linepatternstylelist and specifies the patterns for the observations (not axes).

lw(string) the string argument is a linewidthstylelist and specifies the line widths for the observations (not axes).

msize(string) the string argument is a markersizestylelist and specifies the size of the marker symbols to use for observations (not axes).

ms(string) the string argument is a symbolstylelist and specifies the marker symbols to use for observations BUT must be used in conjunction with the connected option (not axes).

mcolor(string) the string argument is a symbolstylelist and specifies the marker colors to use for observations BUT must be used in conjunction with the connected option (not axes).

rlabel(numlist) specifies the ticks and labels of the spokes. The default is to have 5 values displayed, note that the
value that is the centre or smallest tick is suppressed but the value is included as a note below the graph. The note can
be overwritten by using the note() option.

labsize(string) the string argument is a textsizestyle and specifies the text size of the node labels (not axes).

radial(varname) specifies a variable to be plotted as spikes along the spokes of the plot.

axelaboff specifies that axes labels are removed.

axelc(string) the string argument is a colorlist and specifies the colors for the axes.

axelw(string) the string argument is a linewidthlist and specifies the line widths for the axes.

axelp(string) the string argument is a patternlist and specifies the patterns for the axes.

connected specifies that rather than a line graph of observations but a connected line graph is drawn.

* additional twoway_options can be specified, for example titles() and notes(), but not every possible option is allowed.

Examples

The examples below highlight the use of the radar plot on the Auto dataset. The only limitation
is the number of "spokes" hence the commands are limited to just the foreign cars. Technical note:
the limitation on the number of spokes is unknown because the limit is due to the size of macros
being returned as part of a rclass program. The aspect ratio should be set to 1 but occassionally
Stata's scaling of the plotregion can give skewed plots so the aspect() option can adjust any skew.

Click below to load dataset

sysuse auto

Click below (after the dataset is loaded to see the distribution of weight for the foreign makes of car

radar make weight if foreign, aspect(1)

Click below to see the distribution of turn mpg and trunk for each foreign make of car.

radar make turn mpg trunk if foreign, aspect(1)

radar make turn mpg trunk if foreign, title(Nice Radar graph) aspect(1)

radar make turn mpg trunk if foreign, title(Nice Radar graph) lc(red blue green) lp(dash dot dash_dot) aspect(1)

radar make turn mpg trunk if foreign, title(Nice Radar graph) lc(red blue green) r(0 12 14 18 50) aspect(1)

radar make turn mpg trunk if foreign, title(Nice Radar graph) lc(red blue green) lw(*1 *2 *4) r(0 12 14 18 50) aspect(1)

radar make turn mpg trunk if foreign, title(Nice Radar graph) lc(red blue green) lw(*1 *2 *4) r(0 12 14 18 50) labsize(*.5) aspect(1)

radar make turn mpg trunk if foreign, title(Nice Radar graph) lc(red blue green) lw(*1 *2 *4) r(0 12 14 18 50) connected ms(D Oh S) labsize(*.5) aspect(1)

There is no real advantage of a radar diagram compared to a scatter plot unless there was some sort of directional data.

To add extra spikes for trunk instead of the contour

radar make turn mpg if foreign,radial(trunk) title(Nice Radar graph) lc(red blue green) lw(*1 *2 *4) r(0 12 14 18 50) labsize(*.5) aspect(1)

If you want to remove the labels from the axes use the axelaboff option

radar make turn mpg if foreign,radial(trunk) title(Nice Radar graph) lc(red blue green) lw(*1 *2 *4) r(0 12 14 18 50) labsize(*.5) axelaboff aspect(1)

Stored results

Locals

r(maxarea) is the returned maximum area of the radar polygon given the maximum and minimum values on the plot

r(area_) is the return area of the radar plot, the name of variable will be in the return name e.g. area_weight

Author

Prof Adrian Mander, Centre for Trials Research, Cardiff University .

Email mandera@cardiff.ac.uk

See Also

Related commands:

Other Graphic Commands I have written:

batplot (if installed) ssc install batplot (to install)

cdfplot (if installed) ssc install cdfplot (to install)

contour (if installed) ssc install contour (to install)

drarea (if installed) ssc install drarea (to install)

graphbinary (if installed) ssc install graphbinary (to install)

metagraph (if installed) ssc install metagraph (to install)

palette_all (if installed) ssc install palette_all (to install)

plotbeta (if installed) ssc install plotbeta (to install)

plotmatrix (if installed) ssc install plotmatrix (to install)

surface (if installed) ssc install surface (to install)

trellis (if installed) ssc install trellis (to install)