geom_xsidedensity | R Documentation |
The xside and yside variants of geom_density is geom_xsidedensity and geom_ysidedensity.
geom_xsidedensity(
mapping = NULL,
data = NULL,
stat = "density",
position = "identity",
...,
na.rm = FALSE,
orientation = "x",
show.legend = NA,
inherit.aes = TRUE,
outline.type = "upper"
)
geom_ysidedensity(
mapping = NULL,
data = NULL,
stat = "density",
position = "identity",
...,
na.rm = FALSE,
orientation = "y",
show.legend = NA,
inherit.aes = TRUE,
outline.type = "upper"
)
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 naming the adjustment
(e.g. |
... |
Other arguments passed on to |
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 |
outline.type |
Type of the outline of the area; |
XLayer or YLayer object to be added to a ggplot object
ggplot(mpg, aes(displ, hwy, colour = class)) +
geom_point(size = 2) +
geom_xsidedensity() +
geom_ysidedensity() +
theme(axis.text.x = element_text(angle = 90, vjust = .5))
ggplot(mpg, aes(displ, hwy, colour = class)) +
geom_point(size = 2) +
geom_xsidedensity(aes(y = after_stat(count)),position = "stack") +
geom_ysidedensity(aes(x = after_stat(scaled))) +
theme(axis.text.x = element_text(angle = 90, vjust = .5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.