Description Usage Arguments Value Author(s) Examples
Show interval data as arrows.
1 2 3 4 5 |
data |
A |
... |
Extra parameters such as aes() passed. |
xlab |
Label for x |
ylab |
Label for y |
main |
Title for plot. |
angle |
The angle of the arrow head in degrees (smaller numbers produce narrower, pointier arrows). Essentially describes the width of the arrow head. |
length |
A unit specifying the length of the arrow head (from tip to base). |
type |
One of "open" or "closed" indicating whether the arrow head should be a closed triangle. |
stat |
Character vector specifying statistics to use. "stepping" with
randomly assigned stepping levels as y varialbe. "identity" allow
users to specify |
facets |
Faceting formula to use. |
arrow.rate |
Arrow density of the arrow body. |
group.selfish |
Passed to |
A 'Layer'.
Tengfei Yin
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | set.seed(1)
N <- 100
require(GenomicRanges)
## ======================================================================
## simmulated GRanges
## ======================================================================
gr <- GRanges(seqnames =
sample(c("chr1", "chr2", "chr3"),
size = N, replace = TRUE),
IRanges(
start = sample(1:300, size = N, replace = TRUE),
width = sample(70:75, size = N,replace = TRUE)),
strand = sample(c("+", "-", "*"), size = N,
replace = TRUE),
value = rnorm(N, 10, 3), score = rnorm(N, 100, 30),
sample = sample(c("Normal", "Tumor"),
size = N, replace = TRUE),
pair = sample(letters, size = N,
replace = TRUE))
## ======================================================================
## default
## ======================================================================
ggplot(gr) + geom_arrow()
# or
ggplot() + geom_arrow(gr)
## ======================================================================
## facetting and aesthetics
## ======================================================================
ggplot(gr) + geom_arrow(facets = sample ~ seqnames, aes(color = strand, fill = strand))
## ======================================================================
## stat:identity
## ======================================================================
ggplot(gr) + geom_arrow(stat = "identity", aes(y = value))
## ======================================================================
## stat:stepping
## ======================================================================
ggplot(gr) + geom_arrow(stat = "stepping", aes(y = value, group = pair))
## ======================================================================
## group.selfish
## ======================================================================
ggplot(gr) + geom_arrow(stat = "stepping", aes(y = value, group = pair), group.selfish = FALSE)
## ======================================================================
## other options to control arrow angle, density, ...
## ======================================================================
library(grid)
ggplot(gr) + geom_arrow(stat = "stepping", aes(y = value, group = pair),
arrow.rate = 0.01, length = unit(0.3, "cm"), angle = 45,
group.selfish = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.