View source: R/visual__scatterPlot.R
scatterPlot | R Documentation |
Model: y ~ x.
scatterPlot(
x,
y,
z,
x.bg = NA,
y.bg = NA,
z.bg = NA,
log = "both",
log.base = 10,
replace.zero = 1e-05,
breaks.min = 0,
breaks.max = 1,
breaks.n = 51,
col.grad = c("blue", "green", "red"),
log.z = FALSE,
log.z.base = 10,
output = "plot.png",
w = 800,
h = 640,
title = "Y~X",
x.lab = "X",
y.lab = "Y",
cex.main = 1.5,
cex.lab = 1.5,
cex.axis = 1.5,
x.extension = c(0, 0),
y.extension = c(0, 0),
margin = c(4.5, 4.5, 3, 2),
joint.col = FALSE,
col.bg = "grey",
pch.bg = 1,
cex.bg = 1,
pch = 19,
cex = 1,
show.range = FALSE,
x.range = NA,
x.bg.range = NA,
range.pch = ".",
cex.range = 1,
add.line = FALSE,
line.a = NULL,
line.b = NULL,
line.h = NULL,
line.v = NULL,
line.style = 3,
line.col = "grey",
turnoff.dev = TRUE
)
x |
explanatory variable of your interest to be plotted. |
y |
response variable of your interest to be plotted. |
z |
the variable for generating a colour gradient. It is in the same order of both x and y. |
x.bg |
and y.bg: background values of X and Y respectively to be contrasted with x and y. The function makes a scatter plot of x.bg and y.bg at first. |
z.bg |
the variable for coding colours of (X.bg, Y.bg) with the same colour gradient defined by c(z, z.bg). In practice, x, y and z are three columns of the same data frame. log = c("both", "x", "y", "none"), determines whether to apply logarithmic transformation to x or y. |
log.base |
the base for logarithmic transformation. The default transformtion takes log10. |
replace.zero |
a small value used for replacing zero values before taking logarithms. Only takes effect if log != "none". |
breaks.min |
and breaks.max determine the lower bound and upper bound for factorising the variable z. |
breaks.n |
the number of breaks for dividing z into levels. The number of colour gradients is n-1. |
col.grad |
a vector of characters defining boundaries of the colour gradient. |
log.z |
whether to take the same logarithmic transformation for both z and z.bg. |
log.z.base |
the base for the logarithmic transformation of z and z.bg. |
output |
the name of the output PNG file. |
w |
define the width of the output picture. |
h |
define the height of the output picture. |
title |
configure the title of the plot. |
x.lab |
configure the label of X axis of the plot. |
y.lab |
configure the label of Y axis of the plot. |
cex.main |
cex.lab and cex.axis set the sizes of the title, labels and axes of the plot. |
x.extension |
and y.extension configure the extensions to the left/lower and right/upper sides of the plot. |
margin |
a vector of integers to be passed to par(mar = margin). For example, x.extension = c(-1, 1). |
joint.col |
whether to colour all data points with the same colour gradient. Remember to check the break.min and breaks.max when you are using this option. |
col.bg |
will be overridden if joint.col == TRUE. |
pch |
and cex define the point style and size of data points of interests (Y ~ X). |
show.range |
whethter to plot values from which an x is calculated. In this case, X is a summary statistic. |
x.range |
a vector of characters separated by commas, containing every value that generating an X. For example, x.range = c("1,2,3", "2,2,5") |
x.bg.range |
the same kind of vector as x.range for background X values. |
range.pch |
and cex.range determine the type and size of points for values in x.range. |
add.line |
determines whether to add a guideline to the plot. |
line.style |
the lty argument for abline(.) |
line.col |
the colour of the guideline. |
turnoff.dev |
not to call dev.off() if turnoff.dev = FALSE so that a user can add more features to the plot. |
line.a/b/h/v |
four arguments (a, b, h, v) to be passed to R's build-in function abline. |
Yu Wan (wanyuac@gmail.com)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.