Description Usage Arguments Details
for cont~cat, we need a boxplot with jittered points. An ANOVA p value is needed. A summary of anova model can be available.
1 2 3 4 5 6 7 8 9 10 11 12 | plotContCat(x, y, main, tag, col = NULL, colI = NULL, colVar = NULL,
colVar_pal = NULL, type = "jitter", xlab = "", ylab = "",
useRankTest = FALSE, print = TRUE, ignoreNA = TRUE, order = FALSE,
decreasing_order = FALSE, theme_bw = TRUE, ylim = NULL,
jitter_w = 0.2, nybins = 100, barwidth = 0.2, barcol = NULL,
cex.axis = NULL, lx = NULL, ly = NULL, decreasing = TRUE,
labels = NULL, near0 = 0.01, showLegend = TRUE, width = 0.8,
size = 4, sizeForce = NULL, sizex = 12, wrap_width_x = Inf,
sizey = 12, sizetitlerel = 0.8, sizetitleXrel = 1, sizetitleYrel = 1,
anglex = NULL, angley = 0, shape = 20, plot = TRUE, seed = 1000,
expand = TRUE, base = NULL, FCbyRatio = FALSE, levels = NULL,
saveTable = FALSE, pathTable0 = NULL, pathTable = NULL)
|
x |
required to be a factor due to TukeyHSD(aov(y~x, data=mydf)) requires factor x. It is also necessary for the geom_boxplot otherwise a single box would be plotted when x is treated as continuous variable |
y |
continuous vector |
tag |
used to add a tag to the title |
col |
a vector of color specifying the color of box and points. Color correspondance is through scale_color_manual(breaks=levels(x), values=col) |
colI |
a vector of color of length(x) specifying the color of points. |
type |
plot type, either 'jitter' by geom_jitter (y is fixed) , 'dotplot' by geom_dotplot (y is binned), or 'barplot' by geom_barplot() |
xlab |
xlab |
ylab |
ylab |
useRankTest |
whether to use wilcox rank test in place of t test; only relevant if only two categories is found. |
print |
print text on console for test result |
ignoreNA |
whether to exclude the bar of NAs in the data. Default is to leave it there. Notice this will not affect the P value since NAs is not treated as a separate group but deleted |
order |
whether order factor by median (so that to match with the median bar in boxplot) of y values |
theme_bw |
logical if bw theme is imposed |
nybins |
number of bins on y axis if type=='dotplot'; this controls how y is grouped; dot size is determined through size; |
barwidth |
barwidth when type='barplot' |
barcol |
barcol when type='barplot' |
cex.axis |
size of index text when type='barplot' |
lx, |
ly legend position when type='barplot' |
decreasing |
how the factor level are ordered, decreasing TRUE or FALSE |
labels |
index text, e.g. cell line labels to show. default is integer index. |
near0 |
when type='barplot', bar at 0 will not be shown due to 0 length; we can use a bar hight of near0 to represent it. |
width |
boxplot width; default is 1, which should be the ggplot2 default |
size |
points size |
sizex |
xaxis text size |
wrap_width_x |
use str_wrap to break long axis into multiple lines; default is not to break by setting this as Inf. |
sizey |
yaxis text size |
anglex |
xaxis text rotation |
angley |
yaxis text rotation |
shape |
points shape |
plot |
if FALSE, no figure will be generated. If TRUE, figure and print will be added |
seed |
jitter is random; add seed to make it reproducible |
expand |
whether to expand the size and axis title (useful if figure is to be copied in slides with multiple panels) |
base |
only relevant if categorical variable is binary which is used to calculate fold change. Default is Null, which will not enable FC calculation. |
FCbyRatio |
only active if two groups present, if specified as TRUE, need also to specify base=1 to be active |
levels |
only relevant if categorical variable is binary which is used to calculate fold change and mean diff. Default is NULL, which will be using alphabetical order, handled by ttestP() |
saveTable |
whether to save anova result in a csv file |
pathTable |
path to the saved csv file. default is NULL, which will be set as file.path(getwd(), 'OutputData/scatterTables') |
decreasing |
order direction of the bars |
modified on 2014/01/29: x can be cont, y can be cat. This can be implemented by cord_flip() modified on 2014/02/13: add the option ignoreNA. This happens when we want to remove the bar of NA values. Also, n_unique(x) should not count NA as a level when claiming a test name. the reason is that when only 2 unique levels plus NA, we should say this is a t.test
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.