geom_boxploth {ggstance} | R Documentation |
Horizontal box and whiskers plot.
Description
Horizontal version of geom_boxplot()
.
Usage
geom_boxploth(
mapping = NULL,
data = NULL,
stat = "boxploth",
position = "dodge2v",
...,
outlier.colour = NULL,
outlier.color = NULL,
outlier.fill = NULL,
outlier.shape = 19,
outlier.size = 1.5,
outlier.stroke = 0.5,
outlier.alpha = NULL,
notch = FALSE,
notchwidth = 0.5,
varwidth = FALSE,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
Use to override the default connection between
|
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
outlier.colour , outlier.color , outlier.shape , outlier.size , outlier.stroke |
Default aesthetics for outliers. Set to In the unlikely event you specify both US and UK spellings of colour, the US spelling will take precedence. |
outlier.fill |
Default aesthetics for outliers. Set to In the unlikely event you specify both US and UK spellings of colour, the US spelling will take precedence. Sometimes it can be useful to hide the outliers, for example when overlaying
the raw data points on top of the boxplot. Hiding the outliers can be achieved
by setting |
outlier.alpha |
Default aesthetics for outliers. Set to In the unlikely event you specify both US and UK spellings of colour, the US spelling will take precedence. Sometimes it can be useful to hide the outliers, for example when overlaying
the raw data points on top of the boxplot. Hiding the outliers can be achieved
by setting |
notch |
If |
notchwidth |
For a notched box plot, width of the notch relative to
the body (defaults to |
varwidth |
If |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
Aesthetics
geom_boxploth()
understands the following aesthetics (required aesthetics are in bold):
-
y
-
xlower
-
xupper
-
xmiddle
-
xmin
-
xmax
-
alpha
-
colour
-
fill
-
group
-
linetype
-
shape
-
size
-
weight
Learn more about setting these aesthetics in vignette("ggplot2-specs")
.
Examples
library("ggplot2")
# With ggplot2 we need coord_flip():
ggplot(mpg, aes(class, hwy, fill = factor(cyl))) +
geom_boxplot() +
coord_flip()
# With ggstance we use the h-suffixed version:
ggplot(mpg, aes(hwy, class, fill = factor(cyl))) +
geom_boxploth()
# With facets ggstance horizontal layers are often the only way of
# having all ggplot features working correctly, for instance free
# scales:
df <- data.frame(
Group = factor(rep(1:3, each = 4), labels = c("Drug A", "Drug B", "Control")),
Subject = factor(rep(1:6, each = 2), labels = c("A", "B", "C", "D", "E", "F")),
Result = rnorm(12)
)
ggplot(df, aes(Result, Subject))+
geom_boxploth(aes(fill = Group))+
facet_grid(Group ~ ., scales = "free_y")