geom_xsidefunction | R Documentation |
The xside and yside variants of geom_function
geom_xsidefunction(
mapping = NULL,
data = NULL,
stat = "function",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
stat_xsidefunction(
mapping = NULL,
data = NULL,
geom = "function",
position = "identity",
...,
fun,
xlim = NULL,
n = 101,
args = list(),
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
geom_ysidefunction(
mapping = NULL,
data = NULL,
stat = "ysidefunction",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
stat_ysidefunction(
mapping = NULL,
data = NULL,
geom = "ysidefunction",
position = "identity",
...,
fun,
ylim = NULL,
n = 101,
args = list(),
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
mapping |
Set of aesthetic mappings created by |
data |
Ignored by |
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 |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
geom |
The geometric object to use to display the data, either as a
|
fun |
Function to use. Either 1) an anonymous function in the base or
rlang formula syntax (see |
xlim |
Optionally, specify the range of the function. |
n |
Number of points to interpolate along the x axis. |
args |
List of additional arguments passed on to the function defined by |
ylim |
Optionally, restrict the range of the function to this range (y-axis) |
XLayer or YLayer object to be added to a ggplot object
x<- rweibull(100, 2.6, 3)
y<- rweibull(100, 1.8, 3)
xy.df<- data.frame(cbind(x,y))
p <- ggplot(xy.df, aes(x, y)) +
geom_point(colour = "blue", size = 0.25) +
geom_density2d() +
geom_xsidedensity(fill = "blue", alpha = .3) +
geom_ysidedensity(fill = "blue", alpha = .3) +
stat_xsidefunction(fun = dweibull, args = list(shape = 1.8, scale = 3), colour = "red") +
stat_ysidefunction(fun = dweibull, args = list(shape = 2.6, scale = 3), colour = "red") +
theme_classic()
p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.