qdensity: Draw a univariate density plot

Description Usage Arguments Details See Also Examples

View source: R/qdensity.R

Description

Draw a univariate density plot, with a rug plot underneath.

Usage

1
2
qdensity(x, data, binwidth = NULL, main = "", xlim = NULL, ylim = NULL, xlab = NULL, 
    ylab = NULL)

Arguments

x

variable name which designates variable displayed on the horizontal axis

data

a mutaframe created by qdata

main

the main title

xlim

a numeric vector of length 2 (like c(x0, x1)) for x-axis limits; it will be calculated from the data limits if not specified (NULL). Note when x0 > x1, the axis direction will be reversed (i.e. from larger values to small values)

ylim

y-axis limits; similar to xlim

xlab

x-axis title

ylab

y-axis title

binwidth

the bin width (range(x) / bins by default)

Details

Common interactions are documented in common_key_press. Specific interactions include: Arrow Up/Down in-/de-creases size of points; Arrow Left/Right de-/in-creases binwidth for density; Key Z toggle zoom on/off (default is off); mouse click & drag will specify a zoom window.

Note there are two short tickmarks in the plot denoting the binwidth.

See Also

Other plots: qbar; qboxplot; qhist, qspine; qmval; qparallel; qtime

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
29
30
31
32
33
34
35
library(cranvas)

### (1) ames housing data
qames <- qdata(ameshousing)

qdensity(saleprice, data = qames)

### (2) tennis data
qtennis <- qdata(tennis)

qdensity(first.serve.pct, data = qtennis)

qdensity(second.serve.pts, data = qtennis)
qdensity(serve.speed, data = qtennis)

record_selector(name, data = qtennis)

### (3) pollen data
if (require("animation")) {
    data(pollen, package = "animation")
    qpollen <- qdata(pollen)
    print(qdensity(RIDGE, data = qpollen))
}

### (4) flea (with colors)
data(flea, package = "tourr")
qflea <- qdata(flea, color = species)

qdensity(tars1, data = qflea)

qdensity(tars2, data = qflea)
qdensity(aede1, data = qflea)
qdensity(aede3, data = qflea)

cranvas_off()

ggobi/cranvas documentation built on May 17, 2019, 3:10 a.m.