gplotTwoWay | R Documentation |
gplotTwoWay
produces box-and-whisker, violin plots, and error bars for two-way layout.
gplotTwoWay(formula, data, type = c("errorbar", "violin", "boxplot"),
color_manual = NULL, back_color = FALSE, xlab = NULL, ylab = NULL,
title = NULL, legend.title = NULL, width = NULL, option = c("sd", "se"),
na.rm = TRUE)
formula |
a formula of the form |
data |
a data frame containing the variables in |
type |
a character string to select one of the plots. "errorbar": error bar, "violin": violin plot, and "boxplot": box-and-whisker plot. |
color_manual |
a vector of colors. A palette can also be defined with |
back_color |
a logical to make background grey or white. |
xlab |
a label for the x axis, defaults to a description of x. |
ylab |
a label for the y axis, defaults to a description of y. |
title |
a main title for the plot. |
legend.title |
a legend title for the plot. |
width |
a numeric giving the width of the little lines at the tops and bottoms of the error bars (defaults to 0.35) and the width of the boxes for box-and-whisker plots (defaults to 0.75). |
option |
a character string to select one of the options to draw error bars with standard error or standard deviation. "se": standard error, "sd": standard deviation. Defaults to "se". |
na.rm |
a logical indicating whether NA values should be stripped before the computation proceeds. |
The upper whisker of box-and-whisker plots extends from the hinge to the highest value that is within 1.5 * IQR of the hinge, where IQR is the inter-quartile range. The lower whisker extends from the hinge to the lowest value within 1.5 * IQR of the hinge. Data out of the ends of the whiskers are outliers and plotted as points.
Osman Dag, Muhammed Ali Yilmaz
library(twowaytests)
data(alveolar)
# to obtain error bar (mean +- standard deviation)
gplotTwoWay(cell ~ ovalbumin*treatment, data = alveolar, type = "errorbar", option = "sd")
# to change factor places in graph
gplotTwoWay(cell ~ treatment*ovalbumin, data = alveolar, type = "errorbar", option = "sd")
# to obtain error bar (mean +- standard error)
gplotTwoWay(cell ~ ovalbumin*treatment, data = alveolar, type = "errorbar", option = "se")
# to obtain box-and-whisker plot
gplotTwoWay(cell ~ ovalbumin*treatment, data = alveolar, type = "boxplot")
# to obtain violin plot
gplotTwoWay(cell ~ ovalbumin*treatment, data = alveolar, type = "violin")
# to define specific colors
gplotTwoWay(cell ~ ovalbumin*treatment, data = alveolar, type = "errorbar", option = "sd",
color_manual = c("#999999", "#E69F00", "#56B4E9"))
# to change color palette
library(wesanderson)
gplotTwoWay(cell ~ ovalbumin*treatment, data = alveolar, type = "errorbar", option = "sd",
color_manual = wes_palette(name = "GrandBudapest1", n = 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.