Traces spherical depth contours of a multivariate data set. Supports data on the circle or on the sphere.

1 2 3 4 |

`P` |
The data as a vector, a matrix, a data frame or a list. |

`tracepoints` |
Logical; if TRUE, data points are added to the plot. |

`colpoints` |
A specification for the color of the data points. |

`tracemed` |
Logical; if TRUE, the Tukey median is added to the plot. |

`maxdepth` |
Logical; On the circle only; if TRUE, the maximum depth is printed on the plot. |

`xlim` |
Numeric vectors of length 2, giving the |

`displaymed` |
Logical; On the circle only; if TRUE, the median value is printed on the plot. |

`title` |
On the circle only, a specification for the plot title. |

`ylab` |
On the circle only, a specification for the y axis title. |

`xlab` |
On the circle only, a specification for the x axis title. |

`colmed` |
Color of the Tukey median on the plot. |

`colarc` |
On the sphere only, color of the spherical depth contours on the plot. |

`sizepoints` |
Size of plotted points. |

Supports data on the circle or the sphere. For data on the circle, data must be expressed in polar coordinates as a angle in radians with values between 0 and *2π*. Data on the sphere can be expressed in Euclidean coordinates (*n* by 3 matrix) or in spherical coordinates (*n* by 2 matrix) where the first column contains *θ* and the second column *φ*. The type of coordinates is determined automatically based on the dimensions of the input.

`plot` |
A plot of Tukey spherical depth if the input data are on the circle, or the Tukey spherical depth contours if the input data are on the sphere. |

If data are on the sphere only, a list of 3 elements is also outputted.

`1` |
A sorted vector giving the depths of the plotted contours. |

`2` |
A list of matrices with the vertices of every contour. |

`3` |
The Euclidean coordinates of the Tukey median |

Maxime Genest.

Liu, R.Y., Parelius, J.M. and Singh, K. (1999), Multivariate analysis by data depth: Descriptive statistics, graphics and inference (with discussion), *Ann. Statist.*, **27**, 783–858.

Mardia, K.V. and Jupp, E.J. (1999). *Directional Statistics*, Wiley.

`sdepth`

for calculation of the depth of a point, `smed`

for Tukey's spherical median.

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
## Plot of Tukey spherical depth for data on the circle.
set.seed(2011)
scontour(runif(30,min=0,max=2*pi))
## Tukey spherical depth contours for data
## on the shpere expressed in spherical coordinates.
scontour(cbind(runif(20,min=0,max=2*pi),runif(20,min=0,max=pi)))
## Tukey spherical depth contours for data
## on the sphere expressed in Euclidean coordinates.
x=matrix(rnorm(60),ncol=3)
x=t(apply(x,1,function(y){y/sqrt(sum(y^2))}))
scontour(x)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.