Package 'LSD'

Title: Lots of Superior Depictions
Description: Create lots of colorful plots in a plethora of variations. Try the LSD demotour().
Authors: Bjoern Schwalb [aut, cre], Achim Tresch [aut], Phillipp Torkler [ctb], Sebastian Duemcke [ctb], Carina Demel [ctb], Brian Ripley [ctb], Bill Venables [ctb]
Maintainer: Bjoern Schwalb <[email protected]>
License: GPL-2 | GPL-3
Version: 4.1-0
Built: 2024-09-03 06:59:01 UTC
Source: CRAN

Help Index


Visualize two-dimensional data in a color encoded fashion

Description

Depict any matrix or list in a color encoded rectangular fashion.

Usage

align(
  input,
  colpal = "heat",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  alpha = NULL,
  label = FALSE,
  digits = 1,
  border = NULL,
  xlim = NULL,
  ylim = NULL,
  main = NULL,
  axes = TRUE,
  ...
)

Arguments

input

matrix or list with any type of entries.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

label

logical: if TRUE (FALSE by default), labels are added according to the color scheme (i.e. binning).

digits

integer indicating the number of decimals to be used for binning of continuous data.

border

color for rectangle border(s). Use border = NA to omit borders.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

main

title of the plot, standard graphics parameter.

axes

logical: if TRUE (by default), a box and axes are added to the plot (if FALSE, custom specification of axes can be achieved via basic R graphics functions).

...

additional parameters to be passed to points and plot.

Author(s)

Phillipp Torkler, Bjoern Schwalb

See Also

clusterplot, demotour, disco, colorpalette

Examples

data(seqs)
colpal = c("A" = "darkgreen","C" = "darkblue","G" = "yellow","T" = "darkred")
align(seqs,colpal = colpal,label = TRUE,main = "DNA sequences")

data(homer)
colpal = c("white","black","yellow","wheat3")
align(homer,colpal = colpal,main = "D'OH!",asp = 1,axes = FALSE)

Visualize two-dimensional data clusters

Description

Depict a numeric matrix or list utilizing the underlying distribution quantiles of one dimension in a color encoded fashion.

Usage

clusterplot(
  input,
  label = NULL,
  at = NULL,
  main = NULL,
  xlim = NULL,
  ylim = NULL,
  xlabels = NULL,
  fromto = c(0.05, 0.95),
  colpal = "standardheat",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  nrcol = 25,
  outer.col = "lightgrey",
  quartiles.col = c("grey", "black", "grey"),
  add.quartiles = TRUE,
  separate = TRUE,
  rev = FALSE,
  size = TRUE,
  alpha = NULL,
  axes = TRUE,
  ...
)

Arguments

input

matrix or list with numerical entries.

label

a character vector assigning rows/elements of 'input' to clusters (if specified, multiple clusters can be depicted in different colors and/or subsequent plots).

at

a integer vector containing the x-positions corresponding to the columns of 'input'.

main

title(s) of the plot, standard graphics parameter.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

xlabels

a character vector containing labels for the x-axis.

fromto

a numeric vector containing the range of quantiles (between 0 and 1) to be plotted.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 25, if not specified).

outer.col

R built-in color to be used for outlier lines (lines outside of 'fromto').

quartiles.col

a character vector containing three R built-in colors for quartile lines (c('0.25','0.5','0.75')).

add.quartiles

logical: if TRUE (by default), lines are plotted corresponding to the quartiles.

separate

if TRUE (by default), different clusters are depicted in subsequent plots.

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

size

logical: if TRUE (by default), the size of each cluster is added to the title of the respective plot.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

axes

logical: if TRUE (by default), a box and axes are added to the plot (if FALSE, custom specification of axes can be achieved via basic R graphics functions).

...

additional parameters to be passed to points and plot.

Author(s)

Achim Tresch, Bjoern Schwalb

See Also

singleclusterplot, align, demotour, disco, colorpalette

Examples

samples = 100
probes = 75
at = 1:probes
clus = matrix(rnorm(probes*samples,sd=1),ncol=probes)

clus = rbind(
	t(t(clus)+sin(1:probes/10))+1:nrow(clus)/samples,
	t(t(clus)+sin(pi/2+1:probes/10))+1:nrow(clus)/samples)

quartiles.col = c("transparent","black","transparent")
colpal = c("standardheat","crazyblue","crazyred","crazygreen")

labs = paste("cluster",kmeans(clus,4)$cluster)
clusterplot(clus,fromto=c(0,1))

clusterplot(clus,labs,separate=FALSE,xaxt="n",fromto=c(0.4,0.6),colpal=colpal,
	outer.col="none",ylim=c(-2,3),quartiles.col = quartiles.col)
 
clusterplot(clus,labs,colpal=colpal)

labs = paste("cluster",kmeans(clus,2)$cluster)
colpal = c("greens","purples")
clusterplot(clus,labs,separate=FALSE,xaxt="n",fromto=c(0.3,0.7),colpal=colpal,
	outer.col="none",ylim=c(-1,2),alpha=50,quartiles.col = quartiles.col)

Provides colorpalettes containing R built-in colors

Description

Provides pre-designed colorpalettes (character vectors containing R built-in colors) of this and several other R packages (grDevices, RColorBrewer, colorRamps) as well as custom-made ones.

Usage

colorpalette(
  colpal,
  nrcol = NULL,
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  alpha = NULL,
  rev = FALSE
)

Arguments

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco).

nrcol

a non-negative integer specifying the number of colors to be used (defaults to length of colpal, if not specified).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is returned to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is returned to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is returned.

Value

colorpalette returns a vector containing R built-in colors in hexadecimal representation.

Author(s)

Achim Tresch, Bjoern Schwalb

See Also

disco, demotour

Examples

colorpalette("heat")
colorpalette(c("darkred","grey","darkblue"),10)

Comparisonplot: a fancy scatterplot

Description

A function to compare two vectors extensively.

Usage

comparisonplot(
  x,
  y,
  histbreaks = 30,
  adjust = 1,
  colpal = "heat",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  alpha = NULL,
  rev = FALSE,
  main = "comparisonplot",
  cor = FALSE,
  xlab = NULL,
  ylab = NULL,
  xlim = NULL,
  ylim = NULL,
  ab = FALSE,
  add.density = FALSE,
  col.density = "darkred",
  pimp = FALSE,
  ...
)

Arguments

x

a numeric vector.

y

a numeric vector.

histbreaks

a non-negative integer specifying the number of breaks of the histograms.

adjust

scale the used bandwidth of the density estimate, if add.density = TRUE.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

main

title(s) of the plot, standard graphics parameter.

cor

if TRUE (FALSE by default), the correlation is added to the title.

xlab

x label, standard graphics parameter.

ylab

y label, standard graphics parameter.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

ab

if TRUE (FALSE by default), abline(0,1) is added to the heatscatter.

add.density

if TRUE (FALSE by default), density lines are added to the barplots.

col.density

R built-in color to specify the color of the density line.

pimp

if TRUE (FALSE by default), the plot is pimped.

...

additional parameters to be passed to points and plot.

Author(s)

Bjoern Schwalb

See Also

align, demotour, disco, colorpalette

Examples

points = 10^4
x = c(rnorm(points/2),rnorm(points/2)+4)
y = x + rnorm(points,sd=0.8)
x = sign(x)*abs(x)^1.3

comparisonplot(x,y,histbreaks=30,pch=20)

Complement R colors

Description

Convert R built-in colors to their color complement

Usage

complementarycolor(cols, alpha = NULL)

Arguments

cols

a character vector containing R built-in colors.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

Value

complementarycolor returns a vector containing R built-in colors in hexadecimal representation.

Author(s)

Bjoern Schwalb

See Also

disco, colorpalette, demotour

Examples

complementarycolor(c("red","green","blue"))

Map R colors to hexadecimal representation

Description

Convert R built-in colors to hexadecimal representation.

Usage

convertcolor(cols, alpha = NULL)

Arguments

cols

a character vector containing R built-in colors.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

Value

convertcolor returns a vector containing R built-in colors in hexadecimal representation.

Author(s)

Bjoern Schwalb

See Also

disco, colorpalette, demotour

Examples

convertcolor(c("red","green","blue"))

Convert R colors to greyscale

Description

Greyscale R built-in colors.

Usage

convertgrey(cols, alpha = NULL)

Arguments

cols

a character vector containing R built-in colors.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

Value

convertgrey returns a vector containing R built-in colors in hexadecimal representation.

Author(s)

Bjoern Schwalb

See Also

disco, colorpalette, demotour

Examples

convertgrey(c("red","green","blue"))

Dichromat vision simulation for colorpalettes

Description

Dichromat vision simulation and enhancement according to http://www.daltonize.org.

Usage

daltonize(colpal, cvd = "p", show = TRUE)

Arguments

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

show

logical: if TRUE (by default), the resulting colorpalettes are depicted in an R plot.

Value

daltonize returns a list, where each entry is a vector containing R built-in colors in hexadecimal representation:

simulated

vector of simulated colors

enhanced

vector of enhanced colors

Author(s)

Bjoern Schwalb

References

http://www.daltonize.org

See Also

disco, colorpalette, demotour

Examples

daltonize("heat",cvd = "d")
daltonize("colorblind",cvd = "p")

LSD teaser

Description

A compilation of selected plot examples.

Usage

demotour()

Author(s)

Bjoern Schwalb

See Also

heatscatter, clusterplot, disco, colorpalette, daltonize

Examples

demotour()

Visualize a density in a rectangular fashion

Description

Add a color stripe to an existing plot based on a kernel density estimate.

Usage

densitylane(
  x,
  y,
  pos = 1,
  width = 0.4,
  colpal = "standard",
  rev = FALSE,
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  alpha = NULL,
  horizontal = horizontal,
  nrcol = 75
)

Arguments

x

density$x values of a density object.

y

density$y values of a density object.

pos

the x co-ordinate of the lane (mid point).

width

a numeric value giving the width of the lane.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco) (defaults to "heat", if not specified).

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

horizontal

logical: if TRUE (FALSE by default), rotation of 90 degrees is applied.

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 100, if not specified).

Author(s)

Bjoern Schwalb

See Also

comparisonplot, demotour, disco, colorpalette


Disco (DISplays COlorpalettes)

Description

Displays pre-designed colorpalettes as well as custom-made ones (see colorpalette).

Usage

disco(colpal = NULL, nrcol = NULL, alpha = NULL)

Arguments

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (displays all colorpalettes, if not specified).

nrcol

a non-negative integer specifying the number of colors to be used (defaults to length of colpal, if not specified).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

Author(s)

Bjoern Schwalb

See Also

colorpalette, demotour

Examples

disco()
disco("rdbu",10)

Find preferably distinct R built-in colors

Description

Find a vector of distinct R built-in colors for a pre-defined length ('nrcol').

Usage

distinctcolors(
  nrcol = 10,
  method = "RGB",
  bw = FALSE,
  show = TRUE,
  simulate = TRUE
)

Arguments

nrcol

a non-negative integer specifying the number of colors to be used (defaults to the length of 10, if not specified).

method

character string implying the method for color selection to be used ("RGB" uses a grid in the RGB space (default), "Lab" uses a grid in the Lab space, "goldenratio" uses the golden ratio as spacing between colors in the HSV color space).

bw

logical: if TRUE (FALSE by default), the colors "black" and "white" are removed from the resulting colorpalette.

show

logical: if TRUE (by default), the resulting colorpalettes are depicted in an R plot.

simulate

logical: if TRUE (by default), a converted colorpalettes are additionally depicted to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

Value

distinctcolors returns a vector containing R built-in colors in hexadecimal representation.

Author(s)

Bjoern Schwalb

See Also

disco, colorpalette, demotour

Examples

distinctcolors()

Visualize subgroups of two-dimensional data assuming normal distributions

Description

A scatterplot with additional colored ellipses based on a gaussianity assumption.

Usage

ellipsescatter(
  x,
  y,
  groups,
  colors = NULL,
  pch = 20,
  bgcol = "darkgrey",
  main = "ellipsescatter",
  xlab = NULL,
  ylab = NULL,
  scalesd = 1,
  level = 0.75,
  legend.cex = 1,
  location = "topright",
  ...
)

Arguments

x

a numeric vector.

y

a numeric vector.

groups

a list of indices or vector names to be plotted as groups (not necessarily all of x and y).

colors

a character vector of R build-in colors corresponding to the chosen groups.

pch

the plotting character (to be passed to plot).

bgcol

a R build-in color for non-grouped points.

main

title(s) of the plot, standard graphics parameter.

xlab

x label, standard graphics parameter.

ylab

y label, standard graphics parameter.

scalesd

a numeric value giving the scaling factor for standard deviations in each dimension (defaults to 1).

level

a numeric value (between 0 and 1) giving the confidence level of a pairwise confidence region.

legend.cex

a numerical value giving the amount by which the added legend should be magnified relative to the default.

location

the x and y co-ordinates to be used to position the legend (see 'xy.coords').

...

additional parameters to be passed to points and plot.

Author(s)

Bjoern Schwalb

See Also

demotour, disco, colorpalette

Examples

x = c(rnorm(50),rnorm(100,2),rnorm(50,4))
y = (x + rnorm(200,0,0.8))*rep(c(1,4,1),c(50,100,50))
x = sign(x)*abs(x)^1.3

groups = list("Green" = 1:50,"Red" = 51:150,"Blue" = 151:200)
colors = c("darkgreen","darkred","darkblue")
ellipsescatter(x,y,groups,colors,location = "topleft")

Wrapper function for an empty graphics device

Description

Calls an empty graphics device with a coordinate system of choice.

Usage

emptyplot(xlim = c(-1, 1), ylim = c(-1, 1), ...)

Arguments

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

...

additional parameters to be passed to points and plot.

Author(s)

Bjoern Schwalb

See Also

demotour

Examples

emptyplot()

Visualize two-dimensional data clusters

Description

Depict a numeric matrix or list utilizing the underlying distribution quantiles of one dimension in a color encoded fashion.

Usage

fusionplot(
  x,
  y,
  label = NULL,
  main = NULL,
  xlim = NULL,
  ylim = NULL,
  fromto = c(0.05, 0.95),
  colpal = "standardheat",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  nrcol = 25,
  outer.col = "lightgrey",
  quartiles.col = c("grey", "black", "grey"),
  add.quartiles = TRUE,
  separate = TRUE,
  rev = FALSE,
  size = TRUE,
  alpha = NULL,
  axes = TRUE,
  ...
)

Arguments

x

a numeric vector.

y

a numeric vector.

label

a character vector assigning rows/elements of 'input' to clusters (if specified, multiple clusters can be depicted in different colors and/or subsequent plots).

main

title(s) of the plot, standard graphics parameter.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

fromto

a numeric vector containing the range of quantiles (between 0 and 1) to be plotted.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 25, if not specified).

outer.col

R built-in color to be used for outlier lines (lines outside of 'fromto').

quartiles.col

a character vector containing three R built-in colors for quartile lines (c('0.25','0.5','0.75')).

add.quartiles

logical: if TRUE (by default), lines are plotted corresponding to the quartiles.

separate

if TRUE (by default), different clusters are depicted in subsequent plots.

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

size

logical: if TRUE (by default), the size of each cluster is added to the title of the respective plot.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

axes

logical: if TRUE (by default), a box and axes are added to the plot (if FALSE, custom specification of axes can be achieved via basic R graphics functions).

...

additional parameters to be passed to points and plot.

Author(s)

Achim Tresch, Bjoern Schwalb

See Also

singlefusionplot, align, demotour, disco, colorpalette

Examples

nr = 750
x = 1:nr/300
y = c(rnorm(nr)+sin(2*x)*3,rnorm(nr)+sin(2*x+pi/2)*3)
x = c(x,x)

labs = paste("cluster",c(rep(c(1,2),each = nr)))
colpals = c("oranges","pubu")
qcol = c("transparent","black","transparent")
fusionplot(x,y,labs,separate=FALSE,colpal=colpals,alpha=75,quartiles.col = qcol)

Color a barplot.

Description

Depict a histogram object as a barplot in a color encoded fashion based on a kernel density estimate.

Usage

heatbarplot(
  x,
  colpal = "heat",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  alpha = NULL,
  rev = FALSE,
  horizontal = FALSE,
  nrcol = 100,
  ...
)

Arguments

x

a histogram object.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco) (defaults to "heat", if not specified).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

horizontal

logical: if TRUE (FALSE by default), rotation of 90 degrees is applied.

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 100, if not specified).

...

additional parameters to be passed to points and plot.

Author(s)

Bjoern Schwalb

See Also

comparisonplot, demotour, disco, colorpalette

Examples

points = 10^4
x = c(rnorm(points/2),rnorm(points/2)+4)
x = sign(x)*abs(x)^1.3
xhist = hist(x,plot = FALSE)

heatbarplot(xhist)

Heatboxplot: a colored boxplot

Description

A boxplot with an additional color stripe based on a kernel density estimate.

Usage

heatboxplot(
  x,
  horizontal = FALSE,
  add = FALSE,
  colpal = "standard",
  rev = FALSE,
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  alpha = NULL,
  colpals = NULL,
  nrcol = 75,
  lwd = 1.75,
  axes = TRUE,
  labels = NULL,
  xlim = NULL,
  ylim = NULL,
  xlab = NULL,
  ylab = "",
  main = "heatboxplot",
  nolab = FALSE,
  outline = TRUE,
  boxonly = FALSE,
  adjust = 1,
  quant.from = 0.25,
  quant.to = 0.75,
  range = 1.5,
  border = "black",
  plot.boxplot = TRUE,
  add.quartiles = TRUE,
  add.box = FALSE,
  n.density = 1024,
  cexbox = 0.6,
  ...
)

Arguments

x

data as vector, matrix, list or data.frame.

horizontal

logical: if TRUE (FALSE by default), rotation of 90 degrees is applied.

add

logical: if TRUE (FALSE by default), the boxplot is added to an existing plot.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco) (defaults to "heat", if not specified).

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

colpals

a character vector containing names of LSD colorpalettes (see disco() or disco).

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 100, if not specified).

lwd

linewidth of the box and whiskers.

axes

logical: if TRUE (by default), the axes are plotted.

labels

a character vector of labels.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

xlab

x label, standard graphics parameter.

ylab

y label, standard graphics parameter.

main

title(s) of the plot, standard graphics parameter.

nolab

logical: if TRUE (FALSE by default), the title and ylab are suppressed.

outline

logical: if TRUE (by default), outliers are plotted.

boxonly

logical: if TRUE (FALSE by default), the density is only be plotted in the box.

adjust

a numeric value giving the scaling factor for the used bandwidth (defaults to 1).

quant.from

a numeric value (between 0 and 1) giving the quantile from which the density lane should be plotted.

quant.to

a numeric value (between 0 and 1) giving the quantile to which the density lane should be plotted.

range

a numeric value to determine how far the plot whiskers extend out from the box.

border

an R build-in color for the box and whiskers.

plot.boxplot

logical: if TRUE (by default), the boxplot is added to the density.

add.quartiles

if TRUE (FALSE by default), only the box of the boxplot is added (if plot.boxplot = FALSE).

add.box

logical: if TRUE (by default), the box is added to the plot.

n.density

an integer specifying the number of equally spaced points at which the density is to be estimated.

cexbox

a numerical value giving the amount by which the boxes should be magnified relative to the default.

...

additional parameters to be passed to points and plot.

Author(s)

Bjoern Schwalb

See Also

comparisonplot, demotour, disco, colorpalette

Examples

f = c(rnorm(200),rnorm(200)+4)
h = rf(500,15,15)*10
g = rnorm(300)+1

heatboxplot(h)

heatboxplot(list(f=f,g=g),colpals=c("rdpu","greens"),labels=c("bimodal","unimodal"))

Color a histogram

Description

A histogram with an additional color stripe based on a kernel density estimate.

Usage

heathist(
  x,
  breaks = 20,
  xlab = NULL,
  ylab = NULL,
  main = "heathist",
  colpal = "greys",
  rev = FALSE,
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  alpha = NULL,
  nobox = FALSE,
  add.density = FALSE,
  col.density = "darkred",
  add.rug = TRUE,
  col.rug = "black",
  nrcol = 100,
  ...
)

Arguments

x

a numeric vector.

breaks

a numeric value giving the breaks of the histogram.

xlab

x label, standard graphics parameter.

ylab

y label, standard graphics parameter.

main

title(s) of the plot, standard graphics parameter.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco) (defaults to "heat", if not specified).

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

nobox

logical: if TRUE (FALSE by default), the box of the plot is omitted.

add.density

if TRUE (FALSE by default), a density line is added to the histogram.

col.density

a R build-in color for the density line (if add.density = TRUE).

add.rug

if TRUE (FALSE by default), a rug (1-d plot of the data) is added below the histogram-bars.

col.rug

a R build-in color for the rug (if add.rug = TRUE).

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 100, if not specified).

...

additional parameters to be passed to points and plot.

Author(s)

Bjoern Schwalb

See Also

comparisonplot, demotour, disco, colorpalette

Examples

x = rnorm(1000,mean = sample(c(0,3),size = 1000,prob = c(0.4,0.6),replace = TRUE))
heathist(x,xlab="x",add.density=TRUE,col.rug="darkred")

heathist(x,xlab="x",colpal = "matlablike")

Pairwise colored scatterplot based on a two-dimensional Kernel Density Estimation

Description

Pairwise visualization of two dimensional data in a three dimensional fashion facilitating a color encoded Kernel Density Estimation.

Usage

heatpairs(
  mat,
  main = "heatpairs",
  xlim = NULL,
  ylim = NULL,
  labels = NULL,
  add.points = FALSE,
  group = NULL,
  color.group = "magenta",
  method = "spearman",
  colpal = "heat",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  alpha = NULL,
  rev = FALSE,
  pch = 19,
  cexplot = 0.5,
  cor.cex = 2.5,
  nrcol = 30,
  grid = 100,
  only = "none",
  add.contour = FALSE,
  nlevels = 10,
  color.contour = "black",
  greyscale = FALSE,
  log = "",
  ...
)

Arguments

mat

a matrix with numerical entries.

main

title(s) of the plot, standard graphics parameter.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

labels

a character vector giving the labels to be shown on the diagonal.

add.points

logical: if TRUE (FALSE by default), a certain 'group' of points can be colored in all pairwise plots.

group

indices or rownames of 'mat' to be highlighted in all pairwise plots (not necessarily all).

color.group

R build-in color in which the 'group' of points should be highlighted.

method

a character specifying the correlation method to use ('spearman' (default), 'pearson' or 'kendall').

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco) (defaults to "heat", if not specified).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

pch

plotting 'character'. This can either be a single character or an integer code for one of a set of graphics symbols. (see '?pch', to be passed to plot).

cexplot

a numerical value giving the amount by which the points should be magnified relative to the default.

cor.cex

a numerical value giving the amount by which the correlation characters should be magnified relative to the default.

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 100, if not specified).

grid

an integer specifying the size of the grid used for the KDE.

only

a character string which contains 'x' if the density should only be computed for the x axis, 'y' for the y axis (defaults to 'none' for the two-dimensional case).

add.contour

logical: if TRUE (FALSE by default), the contour lines are added to the plot.

nlevels

an integer giving the number of levels of the contour lines.

color.contour

R build-in color for the contour lines.

greyscale

logical: if TRUE (FALSE by default), the used colorpalette is converted to greyscales.

log

a character string which contains "x" if the x axis is to be logarithmic, "y" if the y axis is to be logarithmic and "xy" or "yx" if both axes are to be logarithmic.

...

additional parameters to be passed to points and plot

Author(s)

Bjoern Schwalb

See Also

comparisonplot, demotour, disco, colorpalette

Examples

points = 10^4
x = rnorm(points/2)
x = c(x,x+2.5)
y = x + rnorm(points,sd=0.75)
x = sign(x)*abs(x)^1.3
mat = cbind(x,y,x + rnorm(points,sd=0.5))
colnames(mat) = c("x","y","z")
rownames(mat) = 1:nrow(mat)

heatpairs(mat,labels=c(expression(Xi),expression(Lambda),expression(Delta)))

A colored scatterplot based on a two-dimensional Kernel Density Estimation

Description

Visualize two dimensional data in a three dimensional fashion facilitating a color encoded Kernel Density Estimation.

Usage

heatscatter(
  x,
  y,
  pch = 19,
  cexplot = 0.5,
  nrcol = 30,
  grid = 100,
  colpal = "heat",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  alpha = NULL,
  rev = FALSE,
  xlim = NULL,
  ylim = NULL,
  xlab = NULL,
  ylab = NULL,
  main = "heatscatter",
  cor = FALSE,
  method = "spearman",
  only = "none",
  add.contour = FALSE,
  nlevels = 10,
  color.contour = "black",
  greyscale = FALSE,
  log = "",
  ...
)

Arguments

x

a numeric vector.

y

a numeric vector.

pch

plotting 'character'. This can either be a single character or an integer code for one of a set of graphics symbols. (see '?pch', to be passed to plot).

cexplot

a numerical value giving the amount by which the points should be magnified relative to the default.

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 100, if not specified).

grid

an integer specifying the size of the grid used for the KDE.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco) (defaults to "heat", if not specified).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

xlab

x labels, standard graphics parameter.

ylab

y labels, standard graphics parameter.

main

title(s) of the plot, standard graphics parameter.

cor

logical: if TRUE (FALSE by default), the correlation is added to the title.

method

a character specifying the correlation method to use ('spearman' (default), 'pearson' or 'kendall').

only

a character string which contains 'x' if the density should only be computed for the x axis, 'y' for the y axis (defaults to 'none' for the two-dimensional case).

add.contour

logical: if TRUE (FALSE by default), the contour lines are added to the plot.

nlevels

an integer giving the number of levels of the contour lines.

color.contour

R build-in color for the contour lines.

greyscale

logical: if TRUE (FALSE by default), the used colorpalette is converted to greyscales.

log

a character string which contains "x" if the x axis is to be logarithmic, "y" if the y axis is to be logarithmic and "xy" or "yx" if both axes are to be logarithmic.

...

additional parameters to be passed to points and plot.

Note

Two-Dimensional Kernel Density Estimation adapted and modified from Venables and Ripley's MASS package (see reference).

Author(s)

Achim Tresch, Bjoern Schwalb

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

See Also

comparisonplot, demotour, disco, colorpalette

Examples

points = 10^4
x = c(rnorm(points/2),rnorm(points/2)+4)
y = x + rnorm(points,sd=0.8)
x = sign(x)*abs(x)^1.3

heatscatter(x,y)

heatscatter(x,y,colpal="bl2gr2rd",main="bl2gr2rd",cor=FALSE)

heatscatter(x,y,cor=FALSE,add.contour=TRUE,color.contour="red",greyscale=TRUE)

heatscatter(x,y,colpal="spectral",cor=FALSE,add.contour=TRUE)

A colored scatterplot based on a two-dimensional Kernel Density Estimation (add to an existing plot)

Description

Visualize two dimensional data in a three dimensional fashion facilitating a color encoded Kernel Density Estimation (add to an existing plot).

Usage

heatscatterpoints(
  x,
  y,
  pch = 19,
  cexplot = 0.5,
  nrcol = 30,
  grid = 100,
  colpal = "heat",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  alpha = NULL,
  rev = FALSE,
  xlim = NULL,
  ylim = NULL,
  only = "none",
  add.contour = FALSE,
  nlevels = 10,
  color.contour = "black",
  greyscale = FALSE,
  log = "",
  ...
)

Arguments

x

a numeric vector.

y

a numeric vector.

pch

plotting 'character'. This can either be a single character or an integer code for one of a set of graphics symbols. (see '?pch', to be passed to plot).

cexplot

a numerical value giving the amount by which the points should be magnified relative to the default.

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 100, if not specified).

grid

an integer specifying the size of the grid used for the KDE.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco) (defaults to "heat", if not specified).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

only

a character string which contains 'x' if the density should only be computed for the x axis, 'y' for the y axis (defaults to 'none' for the two-dimensional case).

add.contour

logical: if TRUE (FALSE by default), the contour lines are added to the plot.

nlevels

an integer giving the number of levels of the contour lines.

color.contour

R build-in color for the contour lines.

greyscale

logical: if TRUE (FALSE by default), the used colorpalette is converted to greyscales.

log

a character string which contains "x" if the x axis is to be logarithmic, "y" if the y axis is to be logarithmic and "xy" or "yx" if both axes are to be logarithmic.

...

additional parameters to be passed to points and plot.

Note

Two-Dimensional Kernel Density Estimation adapted and modified from Venables and Ripley's MASS package (see reference).

Author(s)

Bjoern Schwalb

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

See Also

comparisonplot, demotour, disco, colorpalette

Examples

points = 10^4
x = c(rnorm(points/2),rnorm(points/2)+4)
y = x + rnorm(points,sd=0.8)
x = sign(x)*abs(x)^1.3

plot.new()
plot.window(xlim = c(-5,15),ylim = c(-4,8))
heatscatterpoints(x,y,add.contour=TRUE,color.contour="green",greyscale=TRUE)
axis(1)
axis(2)
box()

homer

Description

Homer Simpson as a list!

Usage

homer

Format

This list contains 31 character vectors of length 22 encoding Homer Simpson.


Intersphere: a fancy Venn diagram

Description

Create circles for visualizing overlaps between up to 4 datasets.

Usage

intersphere(
  data,
  colors = NULL,
  alpha = 25,
  cex = 1,
  expand.circles = 1,
  expand.lims = 1.5,
  main = "intersphere: overlap diagram",
  onlySets = seq(length(data), 2, by = -1)
)

Arguments

data

a list with n entries having elements that can be represented as sets (have union and intersect methods).

colors

a character vector of R build-in colors for circles representing different sets.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

cex

a numeric value giving the character expansion factor for intersect size text inside each circle.

expand.circles

a numeric value giving the expansion factor of circles (multiplicative).

expand.lims

a numeric value giving the expansion of x and y limits (additive).

main

title(s) of the plot, standard graphics parameter.

onlySets

vectors, which n-overlaps should be shown, default to all 1 < n < length(data).

Author(s)

Sebastian Duemcke, Bjoern Schwalb

See Also

demotour, disco, colorpalette

Examples

data = list(
	"A" = sample(1:200,100),
	"B" = sample(1:200,150),
	"C" = sample(1:200,50))

intersphere(data,colors = c("orange","skyblue","green"))

data = list(
	"A" = sample(1:200,100),
	"B" = sample(1:200,150),
	"C" = sample(1:200,50),
	"D" = sample(1:200,75))

colors = c("orange","skyblue","green","purple")
intersphere(data,colors,expand.circles = 0.5,expand.lims = 0.5)

One-dimensional scatterplot

Description

Visualize one-dimensional data in its every detail.

Usage

linesplot(
  x,
  labels = NULL,
  col = "black",
  cols = NULL,
  alpha = 25,
  xlim = NULL,
  ylim = NULL,
  xlab = NULL,
  ylab = "",
  las = 1,
  outline = TRUE,
  cexbox = 0.6,
  addboxes = FALSE,
  border = "black",
  range = 1.5,
  lwd = 1.5,
  main = "LSD.linesplot",
  ...
)

Arguments

x

numeric data as vector, matrix, list or data.frame.

labels

a character vector of labels.

col

a R build-in color.

cols

a character vector of R build-in colors.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

xlab

x label, standard graphics parameter.

ylab

y label, standard graphics parameter.

las

las=1: horizontal text, las=2: vertical text (x-axis labels).

outline

logical: if TRUE (by default), outliers are plotted.

cexbox

a numerical value giving the amount by which the boxes should be magnified relative to the default.

addboxes

logical: if TRUE (FALSE by default), boxplots be added to the plot.

border

a R build-in color for the box and the whiskers (if addboxes = TRUE).

range

this determines how far the plot whiskers extend out from the box.

lwd

linewidth of the box and whiskers.

main

title(s) of the plot, standard graphics parameter.

...

additional parameters to be passed to points and plot.

Author(s)

Bjoern Schwalb

See Also

demotour, disco, colorpalette

Examples

l = list()
for (i in 1:10){l[[i]] = rnorm(100,sqrt(i^2.5),1+i/2)}

linesplot(l,alpha=25,border="darkred",addboxes = TRUE,outline=FALSE)

Custom-built piechart version

Description

Piecharts at arbitrary position and radii.

Usage

LSD.pie(
  props,
  x = 0,
  y = 0,
  radius = 1,
  colpal = "prgn",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  edges = 1000,
  add = FALSE,
  xlim = c(-1, 1),
  ylim = c(-1, 1),
  main = "LSD.pie: piecharts",
  alpha = NULL,
  addPercent = FALSE,
  textcol = "black",
  clockwise = FALSE,
  init.angle = 0,
  labels = c(),
  cex = 1,
  cex.percentage = cex,
  border = NA,
  ...
)

Arguments

props

a numeric vector giving the relations of the pie pieces (need not to be normalized).

x

x-position of the piechart.

y

y-position of the piechart.

radius

a numeric value giving the radius of the piechart.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco) (defaults to "heat", if not specified).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

edges

an integer giving the number of edges the "circle" will have.

add

logical: if TRUE (FALSE by default), the pie is added to an existing plot.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

main

title(s) of the plot, standard graphics parameter.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

addPercent

logical: if TRUE (FALSE by default), the percentage of each slice is written inside of the pie.

textcol

a R build-in color for the percentages of addPercent.

clockwise

if TRUE (FALSE by default), slices drawn clockwise (counter clockwise, if FALSE).

init.angle

a numerical value representing an angle as a starting angle for the drawn slices.

labels

a character vector giving the names for the pie slices.

cex

scaling a numeric value giving the expansion factor for the slice names (if labels are given).

cex.percentage

a numeric value giving the expansion factor for the percentage values (if addPercent = TRUE).

border

a R build-in color giving the border color (NA by default).

...

additional parameters to be passed to points and plot.

Author(s)

Bjoern Schwalb, Carina Demel

See Also

demotour, disco, colorpalette

Examples

emptyplot(xlim=c(1,9),ylim=c(1,9))
mtext(paste("LSD.pie: piecharts"),3,2,cex=1.25)
polygon(c(4,2,4,7,8),c(4,8,4,2,8))
LSD.pie(sample(1:50,5),4,4,add=TRUE,radius=2,colpal="prgn",alpha=75)
LSD.pie(sample(1:50,5),2,8,add=TRUE,colpal="prgn",alpha=75)
LSD.pie(sample(1:50,5),8,8,add=TRUE,colpal="prgn",alpha=75)
LSD.pie(sample(1:50,5),7,2,add=TRUE,colpal="prgn",alpha=75)

Interpolate rows of a matrix to extend the number of cols

Description

Interpolate rows of a matrix to yield a smooth transitions.

Usage

makemovie(input, timepoints = NULL, timestep = 1, motionline = NULL)

Arguments

input

a matrix with numerical entries.

timepoints

a integer vector containing the timepoints corresponding to the columns of 'input'.

timestep

a non-negative integer specifying the number of timesteps between the existing timepoints (defaults to 1, if not specified).

motionline

a integer vector giving the timepoints of the resulting matrix (derived from timepoints and timesteps by default).

Author(s)

Achim Tresch, Bjoern Schwalb

See Also

clusterplot, align, demotour

Examples

len = 10
x = sin(seq(0,2*pi,length=len*2))
fun = function(){n=sample(1:len,1);return(x[n:(n+len-1)])}
input = t(replicate(7,fun(),simplify=TRUE))
input = input + rnorm(length(input))/2
par(mfrow=c(1,2))
plotmatrix(input,main="original",cols=1:7,type="o")
mov = makemovie(input,timestep=0.2)
plotmatrix(mov,main="interpolated",cols=1:7,type="o")

Visualize two-dimensional data clusters

Description

Depict a numeric matrix or list utilizing the underlying mean and standard deviation estimates of one dimension in a color encoded fashion.

Usage

msdplot(
  input,
  label = NULL,
  at = NULL,
  xlim = NULL,
  ylim = NULL,
  xlab = "",
  ylab = "",
  main = "msdplot",
  xaxt = "s",
  xlabels = NULL,
  las = 1,
  separate = TRUE,
  size = TRUE,
  col = "darkgreen",
  bars = TRUE,
  alpha = 50,
  ...
)

Arguments

input

matrix or list with numerical entries, quantiles of cols will define lines.

label

a character vector assigning rows/elements of 'input' to clusters (if specified, multiple clusters can be depicted in different colors and/or subsequent plots).

at

a integer vector containing the x-positions corresponding to the columns of 'input'.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

xlab

x labels, standard graphics parameter.

ylab

y labels, standard graphics parameter.

main

title(s) of the plot, standard graphics parameter.

xaxt

a character which specifies the x axis type ("n" suppresses plotting of the axis).

xlabels

a character vector containing labels for the x-axis.

las

las=1: horizontal text, las=2: vertical text (x-axis labels).

separate

if TRUE (by default), different clusters are depicted in subsequent plots.

size

logical: if TRUE (by default), the size of each cluster is added to the title of the respective plot.

col

a character vector giving R build-in colors for different clusters.

bars

logical: if TRUE (by default), error bars are added at each position.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

...

additional parameters to be passed to points and plot.

Author(s)

Bjoern Schwalb

See Also

comparisonplot, demotour, disco, colorpalette

Examples

at = c(2,4,8,16,32)
clus = matrix(rnorm(500,sd=0.5),ncol=5)
batch = sample(c(-8,-6,-4,-2),100,replace=TRUE)
clus = clus + cbind(0,0.25*batch,0.5*batch,0.75*batch,batch)
clus = clus - clus[,1]
clus = t(t(clus)*c(0,0.1,0.25,0.5,1))
labs = paste("cluster",kmeans(clus,4)$cluster)

colpal = c("darkgreen","darkblue","darkred","black")
msdplot(clus,labs,at,separate=FALSE,col=colpal,alpha=25,xlabels=at)

msdplot(clus,labs,at,col=colpal,alpha=50,xlabels=at)

Plotting wrapper function to plot plots in printable quality and all kinds of formats

Description

Plotting wrapper function to save plots in R as "pdf", "ps", "jpeg", "png", "bmp" or "tiff".

Usage

plotit(
  filename,
  sw = 1,
  sh = 1,
  sres = 1,
  plotsfkt,
  ww = 7,
  wh = 7,
  pointsize = 12,
  dev.pointsize = 8,
  paper = "special",
  quality = 100,
  units = "px",
  bg = "white",
  fileformat = "jpeg",
  saveit = FALSE,
  notinR = FALSE,
  addformat = NULL
)

Arguments

filename

name of the plot to be saved with the format type suffix.

sw

scaling factor of weight.

sh

scaling factor of height.

sres

scaling factor of the resolution.

plotsfkt

list of plots to be plotted.

ww

width of window.

wh

height of window.

pointsize

the default pointsize of plotted text, interpreted as big points (1/72 inch) for plots to be saved.

dev.pointsize

pointsize of plotted text, interpreted as big points (1/72 inch) for display in R.

paper

needed only if filformat = "pdf" or "ps".

quality

needed only if filformat = "jpeg".

units

needed only if filformat = "jpeg", "png", "bmp" or "tiff".

bg

backgroundcolor.

fileformat

save the plot as "pdf", "ps", "jpeg", "png", "bmp" or "tiff".

saveit

should plot be saved.

notinR

should plot be not plotted in R.

addformat

should plot be saved additionally in another format ("pdf", "ps", "jpeg", "png", "bmp" or "tiff").

Author(s)

Bjoern Schwalb

See Also

demotour, disco, colorpalette

Examples

data(homer)

plotsfkt = function(){
		colpal = c("white","black","yellow","wheat3")
		align(homer,colpal = colpal,main = "D'OH!",asp = 1,axes = FALSE)
}

# choose 'saveit = TRUE' for saving the plot in the specified fileformat #

# choose 'notinR = TRUE' to suppress plotting in R #

plotit("homer",sw = 2,sh = 2,sres = 2,plotsfkt,saveit = FALSE,notinR = FALSE,fileformat = "jpeg")

plotit("homer",sw = 2,sh = 2,sres = 2,plotsfkt,saveit = FALSE,notinR = FALSE,fileformat = "png")

plotit("homer",sw = 2,sh = 2,sres = 2,plotsfkt,saveit = FALSE,notinR = FALSE,fileformat = "bmp")

plotit("homer",sw = 2,sh = 2,sres = 2,plotsfkt,saveit = FALSE,notinR = FALSE,fileformat = "tiff")

plotit("homer",sw = 2,sh = 2,sres = 2,plotsfkt,saveit = FALSE,notinR = FALSE,fileformat = "ps")

plotit("homer",sw = 2,sh = 2,sres = 2,plotsfkt,saveit = FALSE,notinR = FALSE,fileformat = "pdf")

Visualize two-dimensional data

Description

Plot the rows of a matrix as lines along the cols.

Usage

plotmatrix(
  input,
  xlim = NULL,
  ylim = NULL,
  xlab = "",
  ylab = "",
  main = "plotmatrix",
  type = "l",
  lwd = 2,
  at = NULL,
  xlabels = NULL,
  ltys = NULL,
  add = FALSE,
  cols = NULL,
  ...
)

Arguments

input

a matrix with numerical entries.

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

xlab

x lab, standard graphics parameter.

ylab

y lab, standard graphics parameter.

main

title of the plot, standard graphics parameter.

type

what 'type' of plot should be drawn (to be passed to points).

lwd

a positive number giving the line width.

at

a integer vector containing the x-positions corresponding to the columns of 'input'.

xlabels

a character vector containing labels for the x-axis.

ltys

a numeric vector giving the line types for each row of 'input'.

add

logical: if TRUE (FALSE by default), lines are added to existing plot.

cols

a character vector of R build-in colors.

...

additional parameters to be passed to points and plot.

Author(s)

Achim Tresch, Bjoern Schwalb

See Also

clusterplot, demotour, disco, colorpalette

Examples

len = 20
x = sin(seq(0,2*pi,length=len*2))
fun = function(){n=sample(1:len,1); return(x[n:(n+len-1)])}
input = t(replicate(7,fun(),simplify=TRUE))
input = input + rnorm(length(input))/2

plotmatrix(input,cols=1:7)

seqs

Description

TATAbox containing DNA-sequences!

Usage

seqs

Format

This list contains 20 character vectors of TATAbox containing DNA-sequences of length 30.


Visualize two-dimensional data clusters (add to an existing plot)

Description

Depict a numeric matrix or list utilizing the underlying distribution quantiles of one dimension in a color encoded fashion (add to an existing plot).

Usage

singleclusterplot(
  input,
  at = NULL,
  fromto = c(0.05, 0.95),
  colpal = "standardheat",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  nrcol = 25,
  outer.col = "lightgrey",
  rev = FALSE,
  alpha = NULL,
  quartiles.col = c("grey", "black", "grey"),
  add.quartiles = TRUE
)

Arguments

input

matrix or list with numerical entries.

at

a integer vector containing the x-positions corresponding to the columns of 'input'.

fromto

a numeric vector containing the range of quantiles (between 0 and 1) to be plotted.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 25, if not specified).

outer.col

R built-in color to be used for outlier lines (lines outside of 'fromto').

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

quartiles.col

a character vector containing three R built-in colors for quartile lines (c('0.25','0.5','0.75')).

add.quartiles

logical: if TRUE (by default), lines are plotted corresponding to the quartiles.

Author(s)

Achim Tresch, Bjoern Schwalb

See Also

clusterplot, align, demotour, disco, colorpalette

Examples

samples = 100
probes = 200
clus = matrix(rnorm(probes*samples,sd=1),ncol=probes)

clus = rbind(
	t(t(clus)+sin(1:probes/10))+1:nrow(clus)/samples,
	t(t(clus)+sin(pi/2+1:probes/10))+1:nrow(clus)/samples)

emptyplot(xlim = c(1,ncol(clus)),ylim = range(clus))
singleclusterplot(clus)
axis(1)
axis(2)
box()

Visualize two-dimensional data clusters (add to an existing plot)

Description

Depict a numeric matrix or list utilizing the underlying distribution quantiles of one dimension in a color encoded fashion (add to an existing plot).

Usage

singlefusionplot(
  x,
  y,
  fromto = c(0.05, 0.95),
  colpal = "standardheat",
  simulate = FALSE,
  daltonize = FALSE,
  cvd = "p",
  nrcol = 25,
  outer.col = "grey",
  rev = FALSE,
  alpha = NULL,
  quartiles.col = c("grey", "black", "grey"),
  add.quartiles = TRUE
)

Arguments

x

a numeric vector.

y

a numeric vector.

fromto

a numeric vector containing the range of quantiles (between 0 and 1) to be plotted.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco).

simulate

logical: if TRUE (FALSE by default), a converted colorpalette is used to simulate dichromat vision according to http://www.daltonize.org (see daltonize).

daltonize

logical: if TRUE (FALSE by default), a converted colorpalette is used to enhance dichromat vision according to http://www.daltonize.org (see daltonize).

cvd

character string implying the type of color vision deficiency ("p" for protanope, "d" for deuteranope or "t" for tritanope).

nrcol

a non-negative integer specifying the number of colors to be used (defaults to 25, if not specified).

outer.col

R built-in color to be used for outlier lines (lines outside of 'fromto').

rev

logical: if TRUE (FALSE by default), a reversed colorpalette is used.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

quartiles.col

a character vector containing three R built-in colors for quartile lines (c('0.25','0.5','0.75')).

add.quartiles

logical: if TRUE (by default), lines are plotted corresponding to the quartiles.

Author(s)

Achim Tresch, Bjoern Schwalb

See Also

fusionplot, align, demotour, disco, colorpalette

Examples

x = 1:1000/300
y = rnorm(1000)+sin(2*x)*3

emptyplot(xlim = range(x),ylim = range(y))
singlefusionplot(x,y,colpal = "ylgnbu")
axis(1)
axis(2)
box()

Visualize two-dimensional data clusters (add to an existing plot)

Description

Depict a numeric matrix or list utilizing the underlying mean and standard deviation estimates of one dimension in a color encoded fashion (add to an existing plot).

Usage

singlemsdplot(
  input,
  col = "darkgreen",
  alpha = 50,
  bars = TRUE,
  length = 0.25,
  at = NULL
)

Arguments

input

data as matrix or list.

col

a character vector of R build-in colors.

alpha

alpha value: a two-digit integer between 01 and 99 for color opacity, i.e. appearance of partial or full transparency (usage omitted by default).

bars

logical: if TRUE (by default), error bars are added at each position.

length

a numeric value scaling the width of the bars.

at

a integer vector containing the x-positions corresponding to the columns of 'input'.

Author(s)

Bjoern Schwalb

See Also

comparisonplot, demotour, disco, colorpalette

Examples

samples = 100
probes = 200
clus = matrix(rnorm(probes*samples,sd=1),ncol=probes)

clus = rbind(
	t(t(clus)+sin(1:probes/10))+1:nrow(clus)/samples,
	t(t(clus)+sin(pi/2+1:probes/10))+1:nrow(clus)/samples)

emptyplot(xlim = c(1,ncol(clus)),ylim = range(clus))
singlemsdplot(clus)
axis(1)
axis(2)
box()

Colored rectangular grid

Description

Adds a colored rectangular grid to an existing plot.

Usage

webdesign(xlim, ylim, colpal = "rdbu", xlabels = NULL, ylabels = NULL, ...)

Arguments

xlim

x limits, standard graphics parameter.

ylim

y limits, standard graphics parameter.

colpal

a character vector containing R built-in color names or a name of a LSD colorpalette as a character string (see disco() or disco).

xlabels

a character vector containing labels depicted parallel to the x-axis.

ylabels

a character vector containing labels depicted parallel to the y-axis.

...

additional parameters to be passed to abline().

Author(s)

Bjoern Schwalb

See Also

demotour, disco, colorpalette

Examples

emptyplot(c(-5,5),c(-5,5))
labels = c("2 fold","4 fold","8 fold")
webdesign(c(-5,5),c(-5,5),lty = 2,xlabels = labels,ylabels = labels)

Factorization of the number of windows for plots with device partitions

Description

Create a factorization of the number of windows for plots with device partitions to be used in par(mfrow = ...).

Usage

windowxy(nrwin = 1)

Arguments

nrwin

a non-negative integer specifying the number of windows.

Author(s)

Bjoern Schwalb

See Also

demotour

Examples

windowxy(20)