plotScatter | R Documentation |
Produces a plot describing the relationship between two columns of the outcomes matrix Y
. It allows to chose colors and markers for the levels of the design factors. Ellipses, polygones or segments can be added to group sets of points on the graph.
plotScatter( Y, xy, design = NULL, color = NULL, shape = NULL, points_labs = NULL, title = "Scatter plot", xlab = NULL, ylab = NULL, size = 2, size_lab = 3, drawShapes = c("none", "ellipse", "polygon", "segment"), typeEl = c("norm", "t", "euclid"), levelEl = 0.9, alphaPoly = 0.4, theme = theme_bw() )
Y |
A nxm matrix with n observations and m variables. |
xy |
x- and y-axis values: a vector of length 2 with either the column name(s) of the Y matrix to plot (character) or the index position(s). |
design |
A nxk "free encoded" experimental design data frame. |
color |
If not |
shape |
If not |
points_labs |
If not |
title |
Plot title. |
xlab |
If not |
ylab |
If not |
size |
The points size. |
size_lab |
The size of points labels. |
drawShapes |
Multiple shapes can be drawn based on the |
typeEl |
The type of ellipse, either |
levelEl |
The confidence level at which to draw an ellipse. |
alphaPoly |
The degree of transparency for polygons. |
theme |
ggplot theme, see |
A scatter plot (ggplot).
data("UCH") # Without design plotScatter(Y = UCH$outcomes, xy = c(453, 369)) # With color and shape plotScatter(Y = UCH$outcomes, design = UCH$design, xy = c(453, 369), color = "Hippurate", shape = "Citrate") # With color and drawShapes plotScatter(Y = UCH$outcomes, design = UCH$design, xy = c(453, 369), color = "Hippurate", drawShapes = "ellipse") plotScatter(Y = UCH$outcomes, design = UCH$design, xy = c(453, 369), color = "Hippurate", drawShapes = "polygon") plotScatter(Y = UCH$outcomes, design = UCH$design, xy = c(453, 369), color = "Hippurate", drawShapes = "segment") # Customize shapes library(ggplot2) plotScatter(Y = UCH$outcomes, design = UCH$design, xy = c(453, 369), shape = "Hippurate", size = 3) + scale_discrete_identity(aesthetics = 'shape', guide = 'legend') plotScatter(Y = UCH$outcomes, design = UCH$design, xy = c(453, 369), shape = "Hippurate") + scale_shape_discrete(solid=FALSE) plotScatter(Y = UCH$outcomes, design = UCH$design, xy = c(453, 369), shape = "Hippurate") + scale_shape_manual(values = c(15,16,17)) # With labels plotScatter(Y = UCH$outcomes, design = UCH$design, xy = c(453, 369), points_labs = rownames(UCH$design))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.