drawColorKey: Draw a color key in the current device

Description Usage Arguments Value Author(s) See Also Examples

View source: R/misc.R

Description

Draw a color key in the current device

Usage

1
2
3
4
5
drawColorKey(x, tick.marks = pretty_within(x), labels = tick.marks,
  main = NULL, key.pos = c(0.925, 0.975, 0.05, 0.95), pos = 2,
  nlevels = length(tick.marks),
  color.palette = (grDevices::colorRampPalette(c("lightblue", "yellow",
  "red")))(nlevels), tick.width = c(0.01, 0.0075), add.box = TRUE, ...)

Arguments

x

A numeric vector with the data (it is used to extract the range).

tick.marks

A numeric vector indicating the levels to be included in the axis.

labels

Character vector. When provided, specifies using different labels for the tick marks than those provided by tick.marjks.

main

Character scalar. Title of the key.

key.pos

A numeric vector of length 4 with relative coordinates of the key (as % of the plotting area, see par("usr"))

pos

Integer scalar. Position of the axis as in text.

nlevels

Integer scalar. Number of levels (colors) to include in the color key.

color.palette

Color palette of length(nlevels).

tick.width

Numeric vector of length 2 indicating the length of the inner and outer tick marks as percentage of the axis.

add.box

Logical scalar. When TRUE adds a box around the key.

...

Further arguments to be passed to rect

Value

Invisible NULL.

Author(s)

George G. Vega Yon

See Also

Other visualizations: dgr, diffusionMap, grid_distribution, hazard_rate, plot_adopters, plot_diffnet2, plot_diffnet, plot_infectsuscep, plot_threshold, rescale_vertex_igraph

Examples

1
2
3
4
5
6
7
set.seed(166)
x <- rnorm(100)
col <- colorRamp(c("lightblue", "yellow", "red"))((x - min(x))/(max(x) - min(x)))
col <- rgb(col, maxColorValue = 255)
plot(x, col=col, pch=19)
drawColorKey(x, nlevels = 100, border="transparent",
 main="Key\nLike A\nBoss")

netdiffuseR documentation built on July 18, 2017, 5:01 p.m.

Search within the netdiffuseR package
Search all R packages, documentation and source code