Description Usage Arguments Value Examples
geom_stream_label
geom to create labels to a geom_stream plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | geom_stream_label(
mapping = NULL,
data = NULL,
geom = "text",
position = "identity",
show.legend = NA,
inherit.aes = TRUE,
na.rm = TRUE,
bw = 0.75,
extra_span = 0.01,
n_grid = 100,
method = c("new_wiggle"),
center_fun = NULL,
type = c("mirror", "ridge", "proportional"),
true_range = c("both", "min_x", "max_x", "none"),
sorting = c("none", "onset", "inside_out"),
...
)
|
mapping |
provide you own mapping. both x and y need to be numeric. |
data |
provide you own data |
geom |
change geom |
position |
change position |
show.legend |
show legend in plot |
inherit.aes |
should the geom inherits aesthetics |
na.rm |
remove missing values |
bw |
bandwidth of kernel density estimation |
extra_span |
How many extra range should be used in estimation? Percent of x range added to min and max. |
n_grid |
number of x points that should be calculated. The higher the more smooth plot. |
method |
Only 'new wiggle' is implemented so far. |
center_fun |
a function that returns the y center for each possible x in range of x. |
type |
one of 'mirror' which stacks symmetrically around the x axis, or 'ridge' which stacks from the x-axis, or 'proportional'. |
true_range |
should the true data range be used or the estimation range? |
sorting |
Should the groups be sorted. Either the default 'none', 'onset' or 'inside_out' |
... |
other arguments to be passed to the geom |
a 'ggplot' layer
1 2 3 4 5 6 7 8 | library(ggplot2)
set.seed(123)
df <- data.frame(x = rep(1:10, 3),
y = rpois(30, 2),
group = sort(rep(c("A", "B", "C"), 10)))
ggplot(df, aes(x, y, fill = group, label = group)) +
geom_stream() +
geom_stream_label(n_grid = 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.