Fanplot function

The fan plot

The fan plot

The better alternative to the pie chart represents amount of values given in data.

Fanplot(Datavector,Names,Labels,MaxNumberOfSlices,main='',col, MaxPercentage=FALSE,ShrinkPies=0.05,Rline=1.1, lwd=2,LabelCols="black",...)

Arguments

  • Datavector: [1:n] a vector of n non unique values
  • Names: Optional, [1:k] names to search for in Datavector, if not set unique of Datavector is calculated.
  • Labels: Optional, [1:k] Labels if they are specially named, if not Names are used.
  • MaxNumberOfSlices: Default is k, integer value defining how many labels will be shown. Everything else will be summed up to Other.
  • main: Optional, title below the fan pie, see plot
  • col: Optional, the default are the first [1:k] colors of the default color sequence used in this package, otherwise a character vector of [1:k] specifying the colors analog to plot
  • MaxPercentage: default FALSE; if true the biggest slice is 100 percent instead of the biggest procentual count
  • ShrinkPies: Optional, distance between biggest and smallest slice of the pie
  • Rline: Optional, the distance between text and pie is defined here as the length of the line in numerical numbers
  • lwd: Optional, The line width, a positive number, defaut is 2
  • LabelCols: Color of labels
  • ...: Further arguments to fan.plot like circumferential positions for the labels labelpos or additional arguments passed to polygon

Details

A normal pie plot is dificult to interpret for a human observer, because humans are not trained well to observe angles [Gohil, 2015, p. 102]. Therefore, the fan plot is used. As proposed in [Gohil 2015] the fan.plot() of the plotrix package is used to solve this problem. If Number of Slices is higher than MaxNumberOfSlices then ABCanalysis is applied (see [Ultsch/Lotsch, 2015]) and group A chosen. If Number of Slices in group A is higher than MaxNumberOfSlices, then the most important ones out of group A are chosen. If MaxNumberOfSlices is higher than Slices in group A, additional slices are shown depending on the percentage (from high to low).

Color sequence is automatically shortened to the MaxNumberOfSlices used in the fan plot.

Returns

silent output by calling invisible of a list with - Percentages: [1:k] percent values visualized in fanplot

  • Labels: [1:k] see input Labels, only relevant ones

References

[Gohil, 2015] Gohil, Atmajitsinh. R data Visualization cookbook. Packt Publishing Ltd, 2015.

[Ultsch/Lotsch, 2015] Ultsch. A ., Lotsch J.: Computed ABC Analysis for Rational Selection of Most Informative Variables in Multivariate Data, PloS one, Vol. 10(6), pp. e0129767. doi 10.1371/journal.pone.0129767, 2015.

Author(s)

Michael Thrun

See Also

fan.plot

Piechart

Examples

data(categoricalVariable) Fanplot(categoricalVariable)