plothulls: plothulls for data peeling

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/bagplot.R

Description

plothulls plots convex hulls of a bivariate data set.

Usage

1
2
plothulls(x, y, fraction, n.hull = 1, main, add = FALSE, col.hull, 
    lty.hull, lwd.hull, density = 0, ...) 

Arguments

x

two column matrix of the coordinates of points of x-values of a data set

y

if x is one dimensional then y contains the y-values of the data set

fraction

... of points that lies inside the hull to be plotted

n.hull

number of directions sequential hulls to be plotted

main

title for the graphics

add

if TRUE no new plot is initialized

col.hull

color(s) of the hull(s)

lty.hull

line type(s) of the hull(s)

lwd.hull

line width(s) of the hull(s)

density

density argument of polygon() that draws the hulls

...

further arguments used in the call of plot() or points()

Details

The function plothulls computes hulls of a bivariate data set using the function chull. After finding a hull the hull maybe plotted. Then the data points of the hull will be removed and the hull of the remaining points is computed. The style of plotting a hull depends on the setting of col.hull, lty.hull, lwd.hull and density. density=NA has the effect that the regions of the hulls are filled by a color. Using fraction you can plot a single hull. n.hull defines the number of hull that should be drawn one after the other.

Value

The hull(s) are stored as a list of matrices with two columns, the innermost first and so on.

Note

Version of plothulls: 10/2013

Author(s)

Peter Wolf

References

Green, P.J. (1981): Peeling bivariate data. In: Interpreting Multivariate Data, V. Barnett (ed.), pp 3-19, Wiley. Porzio, Giovanni C., Ragozini, Giancarlo (2000): Peeling multvariate data sets: a new approach. Quanderni di Statistica, Vol. 2.

See Also

bagplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
  # 10 hulls computed from the faithful data and plotted
  plothulls(faithful, n.hull=10, lty.hull=1)
  # plotting additionally a hull with 90 percent of points within the hull
  plot(faithful)
  plothulls(faithful, fraction=.90, add=TRUE, col.hull="red", lwd.hull=3)
  # hull with 10 percent of points within the hull 
  plothulls(faithful, fraction=.10, col.hull="red", lwd.hull=3)
  # first 3 hulls of the cars data set
  n <- 3
  plothulls(cars, n.hull=n, col.hull=1:n, lty.hull=1:n)
  # 5 hulls represented by colored regions
  n <- 5
  cols <- heat.colors(9)[3:(3+n-1)]
  plothulls(cars, n.hull=n, col.hull=cols, lty.hull=1:n, density=NA, col=0)
  points(cars, pch=17, cex=1)
  # 6 hulls: regions colored and boundaries shown
  n <- 6
  cols <- rainbow(n)
  plothulls(cars, n.hull=n, col.hull=cols, lty.hull=1:n, density=NA, col=0)
  plothulls(cars, n.hull=n, add=TRUE, col.hull=1, lwd.hull=2, lty=1, col=0)

Example output

Loading required package: tcltk
Warning message:
no DISPLAY variable so Tk is not available 
[[1]]
      x.hull y.hull
 [1,]  2.200     45
 [2,]  1.983     43
 [3,]  1.783     46
 [4,]  1.750     47
 [5,]  1.600     52
 [6,]  1.667     64
 [7,]  3.500     87
 [8,]  4.083     93
 [9,]  5.100     96
[10,]  5.067     76

[[2]]
      x.hull y.hull
 [1,]  2.350     47
 [2,]  2.150     46
 [3,]  1.917     45
 [4,]  1.867     45
 [5,]  1.750     47
 [6,]  1.700     59
 [7,]  1.750     62
 [8,]  2.383     71
 [9,]  3.317     83
[10,]  4.133     91
[11,]  4.800     94
[12,]  5.000     88
[13,]  5.033     77
[14,]  4.700     73

[[3]]
      x.hull y.hull
 [1,]  3.833     64
 [2,]  2.417     50
 [3,]  2.167     48
 [4,]  1.833     46
 [5,]  1.817     46
 [6,]  1.750     48
 [7,]  1.733     54
 [8,]  1.750     58
 [9,]  1.833     63
[10,]  2.133     67
[11,]  3.600     85
[12,]  3.967     89
[13,]  4.400     92
[14,]  4.617     93
[15,]  4.900     89
[16,]  4.933     88
[17,]  4.933     86
[18,]  4.900     82
[19,]  4.800     75

[[4]]
      x.hull y.hull
 [1,]  2.883     55
 [2,]  2.317     50
 [3,]  1.833     46
 [4,]  1.750     54
 [5,]  1.817     60
 [6,]  2.067     65
 [7,]  3.600     83
 [8,]  4.333     90
 [9,]  4.783     90
[10,]  4.933     86
[11,]  4.817     77
[12,]  4.800     76
[13,]  4.750     75

[[5]]
      x.hull y.hull
 [1,]  2.617     53
 [2,]  1.867     47
 [3,]  1.783     52
 [4,]  1.817     59
 [5,]  1.983     62
 [6,]  3.600     83
 [7,]  4.150     88
 [8,]  4.417     90
 [9,]  4.450     90
[10,]  4.716     90
[11,]  4.850     86
[12,]  4.883     83
[13,]  4.817     78
[14,]  4.733     75

[[6]]
      x.hull y.hull
 [1,]  2.217     50
 [2,]  2.100     49
 [3,]  1.867     48
 [4,]  1.800     51
 [5,]  1.800     54
 [6,]  1.833     59
 [7,]  4.000     86
 [8,]  4.333     89
 [9,]  4.650     90
[10,]  4.800     84
[11,]  4.833     80
[12,]  4.767     78
[13,]  4.533     73

[[7]]
      x.hull y.hull
 [1,]  2.800     56
 [2,]  2.250     51
 [3,]  2.017     49
 [4,]  1.867     49
 [5,]  1.800     53
 [6,]  1.833     57
 [7,]  1.850     58
 [8,]  3.767     83
 [9,]  3.850     84
[10,]  4.367     88
[11,]  4.700     88
[12,]  4.800     82
[13,]  4.833     80
[14,]  4.500     73

[[8]]
      x.hull y.hull
 [1,]  2.400     53
 [2,]  1.933     49
 [3,]  1.917     49
 [4,]  1.867     50
 [5,]  1.800     53
 [6,]  1.883     58
 [7,]  2.017     60
 [8,]  2.400     65
 [9,]  3.917     84
[10,]  4.000     85
[11,]  4.150     86
[12,]  4.600     88
[13,]  4.800     81
[14,]  4.700     78
[15,]  4.500     73

[[9]]
      x.hull y.hull
 [1,]  2.417     54
 [2,]  2.167     52
 [3,]  2.033     51
 [4,]  1.867     50
 [5,]  1.833     54
 [6,]  1.983     59
 [7,]  2.333     64
 [8,]  3.683     81
 [9,]  4.183     86
[10,]  4.417     87
[11,]  4.700     84
[12,]  4.700     80
[13,]  4.667     78
[14,]  4.533     74
[15,]  4.067     69

[[10]]
      x.hull y.hull
 [1,]  4.300     72
 [2,]  4.100     70
 [3,]  1.950     51
 [4,]  1.867     51
 [5,]  1.833     54
 [6,]  2.000     59
 [7,]  3.450     78
 [8,]  3.833     82
 [9,]  4.083     84
[10,]  4.350     85
[11,]  4.600     85
[12,]  4.667     84
[13,]  4.700     83
[14,]  4.583     76
[15,]  4.467     74

      x.hull y.hull
 [1,]  3.833     64
 [2,]  2.417     50
 [3,]  2.167     48
 [4,]  1.833     46
 [5,]  1.817     46
 [6,]  1.750     48
 [7,]  1.733     54
 [8,]  1.750     58
 [9,]  1.833     63
[10,]  2.133     67
[11,]  3.600     85
[12,]  3.967     89
[13,]  4.400     92
[14,]  4.617     93
[15,]  4.900     89
[16,]  4.933     88
[17,]  4.933     86
[18,]  4.900     82
[19,]  4.800     75
     x.hull y.hull
[1,]  4.233     76
[2,]  4.133     75
[3,]  3.567     71
[4,]  3.750     75
[5,]  4.233     81
[6,]  4.350     82
[7,]  4.417     79
[[1]]
      x.hull y.hull
 [1,]     20     32
 [2,]     15     20
 [3,]      7      4
 [4,]      4      2
 [5,]      4     10
 [6,]     14     80
 [7,]     24    120
 [8,]     25     85
 [9,]     23     54

[[2]]
     x.hull y.hull
[1,]     19     36
[2,]     12     14
[3,]      9     10
[4,]      7     22
[5,]     18     84
[6,]     24     93
[7,]     24     70

[[3]]
      x.hull y.hull
 [1,]     17     32
 [2,]     15     26
 [3,]     11     17
 [4,]      8     16
 [5,]     10     34
 [6,]     14     60
 [7,]     18     76
 [8,]     24     92
 [9,]     22     66
[10,]     20     48

[[1]]
      x.hull y.hull
 [1,]     20     32
 [2,]     15     20
 [3,]      7      4
 [4,]      4      2
 [5,]      4     10
 [6,]     14     80
 [7,]     24    120
 [8,]     25     85
 [9,]     23     54

[[2]]
     x.hull y.hull
[1,]     19     36
[2,]     12     14
[3,]      9     10
[4,]      7     22
[5,]     18     84
[6,]     24     93
[7,]     24     70

[[3]]
      x.hull y.hull
 [1,]     17     32
 [2,]     15     26
 [3,]     11     17
 [4,]      8     16
 [5,]     10     34
 [6,]     14     60
 [7,]     18     76
 [8,]     24     92
 [9,]     22     66
[10,]     20     48

[[4]]
      x.hull y.hull
 [1,]     16     32
 [2,]     12     20
 [3,]     10     18
 [4,]     10     26
 [5,]     13     46
 [6,]     15     54
 [7,]     19     68
 [8,]     20     64
 [9,]     20     52
[10,]     19     46

[[5]]
     x.hull y.hull
[1,]     14     26
[2,]     12     24
[3,]     11     28
[4,]     18     56
[5,]     20     56
[6,]     18     42

[[1]]
      x.hull y.hull
 [1,]     20     32
 [2,]     15     20
 [3,]      7      4
 [4,]      4      2
 [5,]      4     10
 [6,]     14     80
 [7,]     24    120
 [8,]     25     85
 [9,]     23     54

[[2]]
     x.hull y.hull
[1,]     19     36
[2,]     12     14
[3,]      9     10
[4,]      7     22
[5,]     18     84
[6,]     24     93
[7,]     24     70

[[3]]
      x.hull y.hull
 [1,]     17     32
 [2,]     15     26
 [3,]     11     17
 [4,]      8     16
 [5,]     10     34
 [6,]     14     60
 [7,]     18     76
 [8,]     24     92
 [9,]     22     66
[10,]     20     48

[[4]]
      x.hull y.hull
 [1,]     16     32
 [2,]     12     20
 [3,]     10     18
 [4,]     10     26
 [5,]     13     46
 [6,]     15     54
 [7,]     19     68
 [8,]     20     64
 [9,]     20     52
[10,]     19     46

[[5]]
     x.hull y.hull
[1,]     14     26
[2,]     12     24
[3,]     11     28
[4,]     18     56
[5,]     20     56
[6,]     18     42

[[6]]
     x.hull y.hull
[1,]     13     26
[2,]     12     28
[3,]     13     34
[4,]     17     50
[5,]     17     40

[[1]]
      x.hull y.hull
 [1,]     20     32
 [2,]     15     20
 [3,]      7      4
 [4,]      4      2
 [5,]      4     10
 [6,]     14     80
 [7,]     24    120
 [8,]     25     85
 [9,]     23     54

[[2]]
     x.hull y.hull
[1,]     19     36
[2,]     12     14
[3,]      9     10
[4,]      7     22
[5,]     18     84
[6,]     24     93
[7,]     24     70

[[3]]
      x.hull y.hull
 [1,]     17     32
 [2,]     15     26
 [3,]     11     17
 [4,]      8     16
 [5,]     10     34
 [6,]     14     60
 [7,]     18     76
 [8,]     24     92
 [9,]     22     66
[10,]     20     48

[[4]]
      x.hull y.hull
 [1,]     16     32
 [2,]     12     20
 [3,]     10     18
 [4,]     10     26
 [5,]     13     46
 [6,]     15     54
 [7,]     19     68
 [8,]     20     64
 [9,]     20     52
[10,]     19     46

[[5]]
     x.hull y.hull
[1,]     14     26
[2,]     12     24
[3,]     11     28
[4,]     18     56
[5,]     20     56
[6,]     18     42

[[6]]
     x.hull y.hull
[1,]     13     26
[2,]     12     28
[3,]     13     34
[4,]     17     50
[5,]     17     40

aplpack documentation built on Sept. 30, 2021, 5:08 p.m.

Related to plothulls in aplpack...