Spider.Plot: Spider plot

Description Usage Arguments Value Author(s) Examples

View source: R/Spider.Plot.R

Description

Generates an spider plot for a decision model

Usage

1
2
3
4
5
6
7
8
Spider.Plot(data, data.label, data.fill, data.color, data.linetype, data.alpha,
  data.size, data.label.color, data.label.size, group, criteria, valor, title,
  title.color, title.size, label.size, label.color, label.angle, label.position,
  theta, grid, grid.color, grid.radius.color, grid.linetype, grid.size,
  grid.radius.linetype, grid.radius.size, axis, axis.label, axis.color,
  axis.size, axis.linetype, axis.angle, axis.label.color, axis.label.size,
  axis.label.displace, axis.label.angle, legend.position, legend.size,
  legend.text.color, plot.margin)

Arguments

data

data.table with the utilities of a decision model

data.label

data label

data.fill

data fill color

data.color

data color

data.linetype

line type for data

data.alpha

alpha scale for data

data.size

line size for data

data.label.color

label color for data

data.label.size

label size for data

group

name for the column of groups

criteria

column name for criteria

valor

column name for utilities

title

plot title

title.color

plot title color

title.size

plot title size

label.size

labels size

label.color

labels color

label.angle

labels angle

label.position

labels position

theta

plot rotation angle

grid

grid for plot

grid.color

grid color

grid.radius.color

grid radius color

grid.linetype

grid line type

grid.size

grid line size

grid.radius.linetype

grid radius line type

grid.radius.size

grid radius line size

axis

axis

axis.label

axis label

axis.color

axis color

axis.size

axis size

axis.linetype

axis line type

axis.angle

axis angle

axis.label.color

axis label color

axis.label.size

axis label size

axis.label.displace

axis label displacement

axis.label.angle

axis label angel

legend.position

label position

legend.size

legend size

legend.text.color

legend text color

plot.margin

plot margin

Value

ggplot2 object with the spider plot

Author(s)

Pedro Guarderas, Andr<c3><a9>s Lopez pedro.felipe.guarderas@gmail.com

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
# Preparing data
library( data.table )
library( ggplot2 )
n<-10
m<-7
cols<-sample( colors()[ grepl('(red|blue|olive|darkgree)', colors() ) ], m, replace = TRUE )

data<-data.frame( grp = paste( 'A', sort( rep( 1:m, n ) ), sep = '' ),
                  cri = factor( rep( paste( 'c', 1:n, sep = '' ), m ), 
                                levels = paste( 'c', 1:n, sep = '' ), ordered = TRUE ),
                  val = runif( m * n ) )

data.label<-paste( 'A', 1:m,  ' class', sep = '' )
data.fill<-cols
data.color<-cols
data.linetype<-rep( 'solid', m )
data.alpha<-rep( 0.05, m )
data.size<-rep( 0.7, m )
data.label.color<-'black'
data.label.size<-15

# Spider plot parameters
title<-'Spider'
title.color<-'red3'
title.size<-20

label.size<-rep( 8, n )
label.color<-rep( 'steelblue4', n )
label.angle<-rep( 0, n )
label.position<-rep( 1.1, n )

theta<-pi/2

grid<-sort( c( 0.1, 0.25, 0.5, 0.75, 1.0 ) )
grid.color<-'grey'
grid.radius.color<-'dodgerblue3'
grid.linetype<-'dashed'
grid.size<-0.5
grid.radius.linetype<-'solid'
grid.radius.size<-0.5

axis<-grid # Same as grid
axis.label<-paste( 100 * axis, '%', sep = '' )
axis.color<-'black'
axis.size<-0.7
axis.linetype<-'solid'
axis.angle<-0.4*pi
axis.label.color<-'darkgreen'
axis.label.size<-5
axis.label.displace<- -0.07
axis.label.angle<-0

legend.position<-c(0.9, 0.9)
legend.size<-0.5
legend.text.color<-'black'

plot.margin<-unit( c( 1.0, 1.0, 1.0, 1.0 ),"cm")


p<-Spider.Plot( data,
                data.label,
                data.fill,
                data.color,
                data.linetype,
                data.alpha,
                data.size,
                data.label.color, 
                data.label.size,
                grp,
                cri,
                val, 
                title,
                title.color,
                title.size,
                label.size, 
                label.color,
                label.angle,
                label.position,
                theta, 
                grid, 
                grid.color, 
                grid.radius.color,
                grid.linetype, 
                grid.size, 
                grid.radius.linetype, 
                grid.radius.size, 
                axis, 
                axis.label,
                axis.color,
                axis.size, 
                axis.linetype, 
                axis.angle, 
                axis.label.color,
                axis.label.size, 
                axis.label.displace,
                axis.label.angle,
                legend.position,
                legend.size,
                legend.text.color,
                plot.margin )

plot(p)

Example output



mau documentation built on May 1, 2019, 8:23 p.m.