geom_xsideboxplot | R Documentation |
The xside and yside variants of geom_boxplot is geom_xsideboxplot and geom_ysideboxplot.
geom_xsideboxplot(
mapping = NULL,
data = NULL,
stat = "boxplot",
position = "dodge2",
...,
outliers = TRUE,
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,
staplewidth = 0,
varwidth = FALSE,
na.rm = FALSE,
orientation = "x",
show.legend = NA,
inherit.aes = TRUE
)
geom_ysideboxplot(
mapping = NULL,
data = NULL,
stat = "boxplot",
position = "dodge2",
...,
outliers = TRUE,
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,
staplewidth = 0,
varwidth = FALSE,
na.rm = FALSE,
orientation = "y",
show.legend = NA,
inherit.aes = TRUE
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this
layer, either as a |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
outliers |
Whether to display ( |
outlier.colour , outlier.color , outlier.fill , outlier.shape , outlier.size , outlier.stroke , 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. |
notch |
If |
notchwidth |
For a notched box plot, width of the notch relative to
the body (defaults to |
staplewidth |
The relative width of staples to the width of the box. Staples mark the ends of the whiskers with a line. |
varwidth |
If |
na.rm |
If |
orientation |
The orientation of the layer. The default ( |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
XLayer or YLayer object to be added to a ggplot object
geom_*sideviolin
df <- expand.grid(UpperCase = LETTERS, LowerCase = letters)
df$Combo_Index <- as.integer(df$UpperCase)*as.integer(df$LowerCase)
p1 <- ggplot(df, aes(UpperCase, LowerCase)) +
geom_tile(aes(fill = Combo_Index))
#sideboxplots
p1 + geom_xsideboxplot(aes(y = Combo_Index)) +
geom_ysideboxplot(aes(x = Combo_Index)) +
#when mixing continuous/discrete scales
#use the following helper functions
scale_xsidey_continuous() +
scale_ysidex_continuous()
#sideboxplots with swapped orientation
#Note: They order of the layers are affects the default
# scale type. If you were to omit the last two scales, the
# data labels may be affected
ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
geom_xsideboxplot(aes(y = Species), orientation = "y") +
geom_point() +
scale_y_continuous() + scale_xsidey_discrete()
#If using the scale_(xsidey|ysidex)_* functions are a bit cumbersome,
# Take extra care to recast your data types.
ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species))+
geom_point() +
geom_xsideboxplot(aes(y = as.numeric(Species)), orientation = "y") +
geom_ysideboxplot(aes(x = as.numeric(Species)), orientation = "x")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.