general.scatter_by: Function to create scatterplots, color-coded by subgroups

Description Usage Arguments Value Author(s) Examples

Description

Function to create scatterplots, color-coded by subgroups

Usage

1
2
3
4
5
6
general.scatter_by(x, y, by = NULL, col.by = 1:length(unique(by)),
  name.by = "", mar = c(6, 4, 2, 1), xlab = "", ylab = "",
  xlim = NULL, ylim = NULL, mark = NULL, xlog = FALSE, ylog = FALSE,
  pch = 1, cex.pch = 0.75, add.reg = FALSE, add.mean = FALSE,
  add.leg = TRUE, cex.mean = 1, file.name = NULL, png.out = TRUE,
  png.width = 6, png.height = 5, ...)

Arguments

x

numeric vector (Required)

y

second numeric vector of the same length than 'x' (Required)

by

character or factor vector of the same length than 'x' to specify by-groups used for color-coding (Default: Null)

col.by

colors for the 'by'-groups(Default: 1:length(unique(by)))

name.by

character, name of the 'by'-variable, used as legend-title

mar

margins of the plot as in 'par()' (Default: c(6,4,1,1))

xlab

character, labels for the x-axis (Default: ”)

ylab

character, labels for the y-axis (Default: ”)

xlim

Range of the x-axis (Default: Null)

ylim

Range of the y-axis (Default: Null)

mark

TODO: This parameter was not documented in original code (Default: Null)

xlog

TRUE/FALSE is x log-transformed? if yes, axis annotation will account for that (Default: FALSE)

ylog

TRUE/FALSE is y log-transformed? if yes, axis annotation will account for that (Default: FALSE)

pch

symbol for the jitter points (default=1, i.e. the same symbol for all points), if at least as many symbols as the number of levels of the 'by.col' variable are given, symbol coding is used in addition to color coding. (Default: 1)

cex.pch

size of the points (Default: 0.75)

add.reg

TRUE/FALSE if true, adds a regression line (Default: FALSE)

add.mean

TODO: This parameter was not documented in original code (Default: FALSE)

add.leg

TRUE/FALSE if true and 'by' is specified, a legend is added to the plot (Default: TRUE)

cex.mean

TODO: This parameter was not documented in original code (Default: 1)

file.name

name for the PNG output file (without '.png' ending) (Default: NULL)

png.out

TRUE/FALSE if true, a png file is created as output, otherwise the plot is created in the R graphic device (Default: TRUE)

png.width

width of PNG file in inches (Default: 6)

png.height

height of PNG file in inches (Default: 5)

...

Additional parameters for par()

Value

PNG files with the scatterplot ('file.name.png') numeric vector with size of the PNG-file in inches for rescaling in RTF

Author(s)

Sebastian Voss, Adam Skubala

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
set.seed(42)
x <- rnorm(500)
y <- x^2+rnorm(500)
by <- factor(c(rep('male', 250),
               rep('female',250)),
             levels=c('male','female'))

general.scatter_by(x, y, by=by, col.by=c('skyblue','tomato'), name.by="Sex",
                   xlab="Sex", ylab="Biomarker", file.name="test", add.reg=TRUE,
                   mar=c(7,4,4,2), xlim=range(x), ylim=range(y), 
                   pch <- c(1, 4), xlog=TRUE, add.mean=TRUE)

## End(Not run)

jhooge/BioViz documentation built on May 19, 2019, 9:28 a.m.