itree: itree

Description Usage Arguments See Also Examples

View source: R/iplots.R

Description

Interactive tree plot with search bar.

Any numeric data can be plotted on the y-axis but the x-axis should be discrete groups. Points will be labeled with their unique names and y-value.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
itree(
  y,
  group,
  ylim = NULL,
  xlab = NULL,
  ylab = NULL,
  main = NULL,
  plotOpts = NULL,
  digits = NULL
)

Arguments

y

a uniquely-named numeric vector

group

vector of grouping (factor-like) variables the same length as y

ylim

y-axis limits

xlab, ylab, main

the x-, y-, and main labels

plotOpts

list of additional plot options; see itreeOpts

digits

integer indicating number of significant digits to use

See Also

iplotMap from the qtlcharts package

saveWidget

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

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
## basic usage with and without groups
itree(setNames(rnorm(10), letters[1:10]))
itree(setNames(rnorm(20), letters[1:20]), group = 1:4)

## another example
set.seed(1)
n <- 100
ng <- 5
gr <- sort(sample(LETTERS[1:ng], n, replace = TRUE))
yv <- kinda_sort(runif(n, -1, 1), n = n / 2) * 100
itree(yv, gr, main = 'Subject response from baseline',
      ylim = c(-100,100), xlab = 'Treatment arm', ylab = '% change')

## search is more useful with lots of data
set.seed(1)
p0 <- function(x) paste0(x, collapse = '')
n <- 500
gr <- replicate(n, (function()
  p0(sample(c('A','T','C','G'), 15, replace = TRUE)))())
y <- setNames(rpois(n, 40), gr)

## hacky way to remove tick labels which start running together
gr_labels <- Map(function(x) p0(rep(' ', x)), sequence(n))

itree(y, unlist(gr_labels), ylab = 'Frequency', xlab = 'Sequence',
      plotOpts = list(tickwidth = 2, linewidth = 5, width = 2000))

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