
visBoxplotAdv
is supposed to visualise a data frame using
advanced boxplot. In addition to boxplot, a scatter plot is also drawn
with various methods to avoid co-incident points so that each point is
visible (with fine-controling the color and plotting character). Also,
these points can be pies or thermometers, which allows an additional
proportation data to be visualised as well.
visBoxplotAdv(
formula,
data,
orientation = c("vertical", "horizontal"),
method = c("center", "hex", "square", "swarm"),
corral = c("none", "gutter", "wrap", "random", "omit"),
corralWidth,
cex = 1,
spacing = 1,
breaks = NULL,
labels,
at = NULL,
add = FALSE,
log = FALSE,
xlim = NULL,
ylim = NULL,
xlab = NULL,
ylab = NULL,
pch = c("circles", "thermometers", "pies")[1],
col = graphics::par("col"),
bg = NA,
pwpch = NULL,
pwcol = NULL,
pwbg = NULL,
pwpie = NULL,
do.plot = TRUE,
do.boxplot = TRUE,
boxplot.notch = FALSE,
boxplot.border = "#888888C0",
boxplot.col = "transparent",
...
)
a formula, such as 'y ~ grp', where 'y' is a numeric vector of data values to be split into groups according to the grouping variable 'grp' (usually a factor)
a data.frame (or list) from which the variables in 'formula' should be taken.
the orientation. It can be one of "vertical" for the vertical orientation, "horizontal" for the horizontal orientation
the method for arranging the points. It can be one of "swarm" for arranging points in increasing order (if a point would overlap an existing point, it is shifted sideways (along the group axis) by a minimal amount sufficient to avoid overlap), "center" for first discretizing the values along the data axis (in order to create more efficient packing) and then using a square grid to produce a symmetric swarm, "hex" for first discretization and then arranging points in a hexagonal grid, and "square" for first discretization and then arranging points in a square grid
the method to adjust points that would be placed outside their own group region. It can be one of "none" for not adjusting runaway points, "gutter" for collecting runaway points along the boundary between groups, "wrap" for wrapping runaway points to produce periodic boundaries, "random" for placing runaway points randomly in the region, and "omit" for omitting runaway points
the width of the "corral" in user coordinates
size of points relative to the default. This must be a single value
relative spacing between points
breakpoints (optional). If NULL, breakpoints are chosen automatically
labels for each group. Recycled if necessary. By default, these are inferred from the data
numeric vector giving the locations where the swarms should be drawn; defaults to '1:n' where n is the number of groups
whether to add to an existing plot
whether to use a logarithmic scale on the data axis
limits for x-axis
limits for y-axis
labels for x-aixs
labels for y-aixs
plotting characters, specified by group and recycled if necessary. In additon to the convertional pch values, it can also be "circles", "thermometers", or "pies". For "pies" (or "thermometers"), users can also specify the proportional values (see below "pwpie") to visualise another information in the pie (or themometer) chart
plotting colors, specified by group and recycled if necessary
plotting background, specified by group and recycled if necessary
point-wise version of pch
point-wise version of col
point-wise version of bg
point-wise proportion used when drawing pies or themometers
whether to draw main plot
whether to draw boxplot. It only works when the main plot is drawn
whether to draw a notch in the boxplot. If the notches of two plots do not overlap this is 'strong evidence' that the two medians differ
the color for the outlines of the boxplots
the color for the bodies of the boxplots
additional graphic parameters for the plot
A data frame with plotting information. It has the same row names as the input data
# NOT RUN {
#data(TCGA_mutations)
#pd <- Biobase::pData(TCGA_mutations)
# only tumor types "LAML" or "BLCA"
#data <- pd[pd$TCGA_tumor_type=="LAML" | pd$TCGA_tumor_type=="BLCA",]
#labels <- levels(as.factor(data$TCGA_tumor_type))
# colors for gender
#pwcol <- as.numeric((data$Gender))
# pie for relative age
#pwpie <- data$Age/(max(data$Age))
#out <- visBoxplotAdv(formula=time~TCGA_tumor_type, data=data, pch="pies", pwcol=pwcol, pwpie=pwpie)
#legend("topright", legend=levels(data$Gender), box.col="transparent", pch=19, col=unique(pwcol))
# }
Run the code above in your browser using DataLab