qtplot: Plot a continuous variable by discrete categories

Description Usage Arguments Details Value Author(s) Examples

View source: R/qtplot.R

Description

Plots a continuous variable (such as a quantitative trait) by discrete categories (such as genotype).

Usage

1
2
3
4
## S3 method for class 'character'
qtplot(object, x, data, ylab, xlab, ylim, col, points.method = "beeswarm", boxplot.layer = "over", ...)
## S3 method for class 'numeric'
qtplot(object, x, data, ylab, xlab, ylim, col, points.method = "beeswarm", boxplot.layer = "over", ...)

Arguments

object

The name or values of the continuous variable

x

The name or values of the discrete category variable

data

A data frame containing values

ylab

A label for the y axis

xlab

A label for the x axis

ylim

y axis range

points.method

Name of method for plotting individual datapoints, either “stripchart” or “beeswarm”

boxplot.layer

Layer to draw the boxplot relative to individual datapoints, either “over”, “under”, or “none”

col

A vector of colours

...

Other arguments, ignored

Details

Generates a plot displaying numerical data (usually continuous) by levels of a factor.

When displaying such data, it is preferable to avoid the loss of information inherent in a classical boxplot, and to display all the individual datapoints if at all possible. However, the boxplot summary remains a desirable adjunct.

The argument points.method specifies how individual datapoints are drawn. The default, “beeswarm”, is deterministic and avoids overlap of individual datapoints unless absolutely necessary, but may be slow for large numbers of datapoints. The alternative, “stripchart”, is fast but is not deterministic and tends to overlap datapoints.

When datapoints are overlapping, it may be possible to visualise this using transparency in col.

Value

Returns an invisible null. The plot is generated as a side effect.

Author(s)

Toby Johnson Toby.x.Johnson@gsk.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(aoex1)
qtplot("bmi", "rs123456", data = aoex1)
with(aoex1, qtplot(bmi, rs123456))
x <- sample(1:2, 1000, replace = TRUE)
y <- rnorm(1000, x, .02)
qtplot(y, x, points.method = "stripchart")
## Not run: 
qtplot(y, x) # takes a long time

## End(Not run)

tobyjohnson/gtx documentation built on Aug. 30, 2019, 8:07 p.m.