iscatter: iscatter

Description Usage Arguments See Also Examples

View source: R/iplots.R

Description

Interactive scatter plot with labelled points.

If labels is a vector, points are labeled as-is and recycled if necessary. Optionally, labels can be a named list where each element of the list is a character vector (or one which can be coerced) having the same length of x; see examples. If x and y are named vectors, points will be labeled without needing to use labels.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
iscatter(
  x,
  y = NULL,
  group,
  col,
  cex = 5,
  xlim = NULL,
  ylim = NULL,
  xlab = NULL,
  ylab = NULL,
  main = NULL,
  labels = NULL,
  plotOpts = NULL,
  digits = NULL
)

Arguments

x, y

vectors of x- and y-coordinates; if y is NULL, x will be plotted along the y-axis by index of x

group

vector of group (factor-like) variables used for additional aesthetics such as col

col

a vector of colors for each unique group; note that colors will be assigned to the sorted levels of group

cex

point size in pixels

xlim, ylim

x- and y-limits

xlab, ylab, main

the x-, y-, and main labels

labels

optional character vector or named list of character vectors to label each point; if NULL, points will be labeled by index

plotOpts

list of additional plot options; see iscatterOpts

digits

integer indicating number of significant digits to use

See Also

iplot from the qtlcharts package

saveWidget

Other iplots: icorr(), icurve(), idot(), itree()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## basic usage
iscatter(1:5, col = 1:5)

## using named vectors
x <- with(mtcars, setNames(mpg, mpg))
y <- with(mtcars, setNames(wt, wt))
iscatter(x, y)

## using the labels parameter
with(mtcars, {
  iscatter(wt, mpg, group = cyl, col = 1:3,
           main = 'Motor Trend car road tests',
           labels = list(model = rownames(mtcars), mpg = mpg, hp = hp))
})

## compare with base graphics
with(mtcars, plot(wt, mpg, col = factor(cyl), pch = 19))

## labels parameter supports additional formatting with html tags
with(ivolcano, {
  iscatter(logFC, -log10(pval), group = pval < 0.05 & abs(logFC) > 1,
           col = c('lightgrey','green'),
           labels = list(
             ' ' = rownames(ivolcano),
             'log<sub>2</sub>(FC)' = round(logFC, 2),
             '<em>p</em>-value' =
               format.pval(ivolcano$pval, digits = 2, eps = .05)))
})

raredd/iplotr documentation built on March 19, 2021, 12:45 a.m.