dots: Dots display

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

Description

The function adds to the current plot an one-dimensional scatter plot with stacking similar to a stem-leaf plot or histograms but using characters. .

Usage

1
2
3
    dots(x = , y = 0.1, xlim = range(x,na.rm=TRUE), stacked = FALSE, hmax= 0.5,
    base = TRUE, axes = FALSE, pch = 21, pch.size = "x", labels = NULL,
    hcex = 1, cex = par("cex"), cex.axis = par("cex.axis"))

Arguments

x

numeric vector to be displayed in the dot plot.

y

numeric. Height of the dots (characters) at the base level. By default y=0.1 thinking on a plot with ylim=c(0,1).

xlim

numeric vector with 2 entries: xmin and xmax. These values determine the width of the displayed dot plot not necessarily equal to the limits of the plot.

stacked

logical. If TRUE characters are stacked, otherwise a scatter plot of the data is displayed at y level using character pch.

hmax

numeric. The maximum height in user units. By default hmax=0.5 thinking on a plot with ylim=c(0,1). See y.

base

logical. If TRUE a horizontal line is displayed at the bottom of the plot.

axes

logical. If TRUE an labelled axis is shown.

pch

numeric or character. Character number or character to be used for the display.

pch.size

numeric. Character to be used to distribute the "dots" (pch). See Details.

labels

character vector. If NULL (default) each point (dot) is displayed using character pch, otherwise vector labels is used for the display. See Details.

hcex

numeric. Expansion (shrink) factor for character height. See details.

cex

numeric. Expansion factor used for character display. See par.

cex.axis

numeric. Expansion factor used in case of labelling the axis.

Details

Function dots adds to the current plot a dot plot similar to a stem-and-leaf plot using characters specified by pch and labels=NULL. If labels is not NULL then it is expected to be a character vector and will will be used to display each of the points. Its use is repeated or cut short if necessary. The function computes the width and height size using character pch.size calling strwidth and strheight, but displays pch instead. Mainly this is used when pch is not given by a quoted character, for example, pch=21. Also, currently the par("mkh") is ignored so hcex is used to compute the "working" height of the characters: hcex*strheight(pch.size,units="user"). If stacked=TRUE, the base line is divided in subintervals of size strwidth(pch.size) and computed the number of points in each subinterval. If maximum number of stacked characters exceed hmax then the characters are overlapped to adjust their total height to hmax.

Value

Invisible data frame with columns (x,y,labels). ‘x’ and ‘y’ are the coordinates in user units of each point and ‘labels’ the corresponding character displayed.

Author(s)

Ernesto Barrios

See Also

dotPlot, anovaPlot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(BHH2)
set.seed(4)
# Defines the height of the plot area between c(0,1)
dotPlot(rnorm(100),xlab="x")

x <- rnorm(100)

# plots (possibly) overlapping points at y=0.3
dots(x,y=0.3)
# plots (possibly) overlapping points at y=0.4
dots(x,y=0.4,stacked=TRUE,base=FALSE)
# plots (hopefully) stacked points at y=0.5 allowing the dots to as high as 0.9
dots(x,y=0.5,stacked=TRUE,base=FALSE,hmax=.9)

Example output



BHH2 documentation built on May 1, 2019, 6:27 p.m.