gstars: Grid-Based 'stars' Function

Description Usage Arguments Details Author(s) See Also Examples

Description

Similar to stars function, but drawn in grid viewport: Draw star plots or segment diagrams of a multivariate data set. With one single location, also draws 'spider' (or 'radar') plots.

Usage

1
2
3
4
5
gstars(x, radius = TRUE, locations = "grid", 
       draw.segments = FALSE, scale = TRUE, full = TRUE, 
       qx = apply(x, 2, quantile, probs = seq(0, 1, 0.1)), 
       quantile=FALSE, col.segments=TRUE, col.stars=FALSE, 
       draw.labels=TRUE, key=FALSE, lwd=0.3, lty=1, cex=1)

Arguments

x

vector, matrix or data frame of data. One star or segment plot will be produced for each row of x. Missing values (NA) are allowed, but they are treated as if they were 0 (after scaling, if relevant).

radius

logical flag: in TRUE, the radii corresponding to each variable in the data will be drawn.

locations

Either two column matrix with the x and y coordinates used to place each of the segment plots; or numeric of length 2 when all plots should be superimposed (for a spider plot). By default, locations = NULL, the segment plots will be placed in a rectangular grid.

draw.segments

logical. If TRUE draws a segment diagram.

scale

logical flag: if TRUE, the columns of the data matrix are scaled independently so that the maximum value in each column is 1 and the minimum is 0. If FALSE, the presumption is that the data have been scaled by some other algorithm to the range [0,1]. If x is a vector scale is forced TRUE.

full

logical flag: if TRUE, the segment plots will occupy a full circle. Otherwise, they occupy the (upper) semicircle only.

qx

matrix or data frame of data for quantiles in background

quantile

logical. If TRUE, draws quantiles in background.

col.segments

colour vector (integer or character, see par), each specifying a colour for one of the segments (variables). If FALSE no colour is used. If TRUE vector of length col(x) is used. Ignored if draw.segments = FALSE.

col.stars

colour vector (integer or character, see par), each specifying a colour for one of the stars (cases). If FALSE no colour is used. If TRUE vector of length col(x) is used. Ignored if draw.segments = TRUE.

draw.labels

logical. If TRUE draws labels.

key

logical. If TRUE draws only labels (e.g. caption)

lwd

line width, passed to gp for Grid functions

lty

line type, passed to gp for Grid functions

cex

numerical value, giving the amount by which plotting text and symbols should be magnified relative to the default, passed to gp for Grid functions

Details

Missing values are treated as 0.

Each star plot or segment diagram represents one row of the input x. Variables (columns) start on the right and wind counter-clockwise around the circle. The size of the (scaled) column is shown by the distance from the center to the point on the star or the radius of the segment representing the variable.

Only one page of output is produced.

Author(s)

Ingo Voglhuber

See Also

gbarplot, gmatplot, gpie, gsymbols, gbxp

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
data(USJudgeRatings)
grid.newpage()

## example

gstars(USJudgeRatings)

grid.newpage()

## no radii
gstars(USJudgeRatings,radius=FALSE)

grid.newpage()

## no labels
gstars(USJudgeRatings, draw.labels=FALSE)

grid.newpage()

## segments of a circle
gstars(USJudgeRatings,draw.segments=TRUE)

grid.newpage()

## spiderplot, no labels
gstars(USJudgeRatings,radius=FALSE, locations="spider", 
           draw.labels=FALSE)

grid.newpage()

## spiderplot with quantiles in background
gstars(USJudgeRatings,radius=FALSE, locations="spider", 
           quantile=TRUE)

grid.newpage()

## spiderplot with quantiles in background
gstars(USJudgeRatings,radius=FALSE, locations="spider",
  qx=apply(USJudgeRatings,2,quantile,probs=seq(0,1,0.25)) , 
           quantile=TRUE,
  draw.labels=FALSE)

grid.newpage()

## draw only labels
gstars(USJudgeRatings, key=TRUE)

gsymbols documentation built on May 2, 2019, 4:44 p.m.

Related to gstars in gsymbols...