Last data update: 2014.03.03

R: Calibration bar for color images
ColorBarR Documentation

Calibration bar for color images

Description

This function produces a color image (color bar) which can be used for the legend to another color image obtained from the functions image or arrayPlot.

Usage

ColorBar(x, horizontal=TRUE, col=heat.colors(50), scale=1:length(x), k=10, ...)

Arguments

x

If "numeric", a vector containing the "z" values in the color image, i.e., the values which are represented in the color image. Otherwise, a "character" vector representing colors.

horizontal

If TRUE, the values of x are represented as vertical color strips in the image, else, the values are represented as horizontal color strips.

col

Vector of colors such as that generated by rainbow, heat.colors, topo.colors, terrain.colors, or similar functions. In addition to these color palette functions, a new function myPalette was defined to generate color palettes from user supplied low, middle, and high color values.

scale

A "numeric" vector specifying the "z" values in the color image. This is used when the argument x is a "character" vector representing color information.

k

Object of class "numeric", for the number of labels displayed on the bar.

...

Optional graphical parameters, see par.

Author(s)

Sandrine Dudoit, Yee Hwa (Jean) Yang.

See Also

image, arrayPlot myPalette.

Examples


par(mfrow=c(3,1))
Rcol <- myPalette(low="white", high="red", k=10)
Gcol <- myPalette(low="white", high="green", k=50)
RGcol <- myPalette(low="green", high="red", k=100)
ColorBar(Rcol)
ColorBar(Gcol, scale=c(-5,5))
ColorBar(1:50, col=RGcol)

par(mfrow=c(1,3))
x<-seq(-1, 1, by=0.01)
ColorBar(x, col=Gcol, horizontal=FALSE, k=11)
ColorBar(x, col=Gcol, horizontal=FALSE, k=21)
ColorBar(x, col=Gcol, horizontal=FALSE, k=51)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(GLAD)

######################################################################################

Have fun with GLAD

For smoothing it is possible to use either
the AWS algorithm (Polzehl and Spokoiny, 2002,
or the HaarSeg algorithm (Ben-Yaacov and Eldar, Bioinformatics,  2008,

If you use the package with AWS, please cite:
Hupe et al. (Bioinformatics, 2004, and Polzehl and Spokoiny (2002,

If you use the package with HaarSeg, please cite:
Hupe et al. (Bioinformatics, 2004, and (Ben-Yaacov and Eldar, Bioinformatics, 2008,

For fast computation it is recommanded to use
the daglad function with smoothfunc=haarseg

######################################################################################

New options are available in daglad: see help for details.

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/GLAD/ColorBar.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ColorBar
> ### Title: Calibration bar for color images
> ### Aliases: ColorBar
> ### Keywords: hplot
> 
> ### ** Examples
> 
> 
> par(mfrow=c(3,1))
> Rcol <- myPalette(low="white", high="red", k=10)
> Gcol <- myPalette(low="white", high="green", k=50)
> RGcol <- myPalette(low="green", high="red", k=100)
> ColorBar(Rcol)
> ColorBar(Gcol, scale=c(-5,5))
> ColorBar(1:50, col=RGcol)
> 
> par(mfrow=c(1,3))
> x<-seq(-1, 1, by=0.01)
> ColorBar(x, col=Gcol, horizontal=FALSE, k=11)
> ColorBar(x, col=Gcol, horizontal=FALSE, k=21)
> ColorBar(x, col=Gcol, horizontal=FALSE, k=51)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>