Learn R Programming

henna (version 0.3.4)

hullPlot: Plot the convex hull of a set of points

Description

This function plots the convex hull of a set of points. It can also draw a vertical or a horizontal line (or both), dividing the hull into areas of different colors.

Usage

hullPlot(
  pointsDF,
  title = "Hull plot",
  xInt = NULL,
  yInt = NULL,
  palette = hpColors(),
  lineColor = "navy",
  lineWidth = 0.3,
  lineType = c("dashed", "solid", "dotted", "dotdash", "longdash", "twodash"),
  hullWidth = 0,
  xLab = "x",
  yLab = "y",
  legendLabs = paste0("Group ", seq(4)),
  legendPos = "bottom",
  pointSize = 1,
  pointShape = 4,
  alpha = 0.2,
  labelDF = NULL,
  labelSize = 2.5,
  labelColor = "black",
  labelRepulsion = 1,
  labelPull = 0,
  maxOverlaps = 10,
  ...
)

Value

An object of class gg.

Arguments

pointsDF

A data frame with the x and y coordinates of the points.

title

Plot title.

xInt

The coordinate where the vertical line intersects the x axis.

yInt

The coordinate where the horizontal line intersects the y axis.

palette

Color palette.

lineColor

The color of the horizontal and vertical dividing lines, if provided. If NULL, no dividing lines will be drawn, though the hull will still be split along these lines if xInt and/or yIntare not NULL.

lineWidth

The width of the horizontal and vertical dividing lines. Ignored if lineColor is NULL.

lineType

The type of the horizontal and vertical dividing lines. Choose between 'dashed','solid', 'dotted', 'dotdash', 'longdash' and 'twodash'. Default is 'dashed'. Ignored if lineColor is NULL.

hullWidth

Width of the convex hull. If 0 (as default), the convex hull will not be displayed.

xLab

Label of x axis.

yLab

Label of y axis.

legendLabs

Legend labels.

legendPos

Legend position.

pointSize

Point size.

pointShape

Point shape.

alpha

Opaqueness level for the colors of the alluvia.

labelDF

Label data frame.

labelSize

Label size. Ignored if labelDF is NULL.

labelColor

Label color. Ignored if labelDF is NULL.

labelRepulsion

Repulsion strength between labels.

labelPull

Attraction strength between a text label and its data point.

maxOverlaps

Maximum overlaps. Ignored if labelDF is NULL.

...

Other arguments passed to centerTitle.

Examples

Run this code
pointsDF <- data.frame(x = c(1, 2, 4, 7, 10,
12, 13, 15, 16),
y = c(1, 1, 2, 3, 3, 2,
1, 2, 1))
hullPlot(pointsDF, 'Hull plot', 7, 1.5)

Run the code above in your browser using DataLab