ggConvexHull: ggConvexHull use ggplot2 to plot a peeled convex hull for a...

View source: R/MakeTIEllipses.R

ggConvexHullR Documentation

ggConvexHull use ggplot2 to plot a peeled convex hull for a set of points described by 2 variables.

Description

ggConvexHull computes a peeled convex hull for a set of points described by 2 variables and plot it. Uses function PeelZeHull derived from the function ExPosition::peeledHull which, in turn, got inspiration from Michael Greenacre package CA. The original code can be found at http://carme-n.org/?sec=code2.

Usage

ggConvexHull(
  data,
  x_axis = 1,
  y_axis = 2,
  percentage = 0.66,
  col.line = "darkorchid4",
  alpha.line = 1,
  line.size = 1,
  line.type = 1,
  col.hull = "darkorchid",
  alpha.hull = 0.4,
  names.of.factors = "Dimension "
)

Arguments

data

an item by variables data,frame or matrix.

x_axis

column number for the first variable. Default = 1

y_axis

column number for the second variable. Default = 2

percentage

proportion of the convexHull to keep, Default: .66

col.line

= the color of the line for the hill. Default is 'darkorchid4'.

alpha.line

= 1, alpha value (transparency) for the lines, takes values between 0 (completely transparent) and 1 (no transparent).

line.size

= 1, thickness of the line for the ellipses.

line.type

= 1 (solid line) the type of line (values from 0 to 6).

col.hull

= 'darkorchid', the color to fill the hull.

alpha.hull

= .4 alpha value (transparency) for the hull.

names.of.factors

= "Dimension", names of the factors. if NULL name.of.factors is dimnames(data)[2], if dimnames(data)[2] is NULL, the dimensions will be labelled "Dimension". This parameter is needed to avoid conflict when plotting these names as they need to be the same as the names of the data used to make the BaseMap plot (i.e., Fi/Fj/Fij).

Value

a ggplot2 object to draw a convex hull

Author(s)

Herve Abdi

Examples

## Not run: 
if(interactive()){
 #EXAMPLE1
 }

## End(Not run)

HerveAbdi/PTCA4CATA documentation built on July 17, 2022, 5:41 a.m.