Mainly a utility for the lattice and ggplot2 plotting
functions, ash_points()
returns the points to be plotted.
ashplot(x, ..., width = NULL, adjust = NULL, panel = panel.ashplot, prepanel = prepanel.default.ashplot)
prepanel.default.ashplot(x, darg, groups = NULL, subscripts = TRUE, ...)
panel.ashplot(x, darg = list(), plot.points = FALSE, ref = FALSE, groups = NULL, jitter.amount = 0.01 * diff(current.panel.limits()$ylim), type = "p", ..., identifier = "ash")
ash_points(x, binwidth = NULL, adjust = 1)
StatAsh
stat_ash(mapping = NULL, data = NULL, geom = "line", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, binwidth = NULL, adjust = 1, ...)
geom_ash(mapping = NULL, data = NULL, stat = "ash", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, binwidth = NULL, adjust = 1, ...)
data
, a
data frame in which to find the variales used for the plot.width
. Primarily useful when width
is
not specified. Increasing adjust
makes the plot smoother.TRUE
, FALSE
, "jitter"
, or "rug"
plot.points="jitter"
, the value to use as the amount
argument to jitter
.type
argument,
if specified, from affecting the display of the ASH.NULL
(the default) the
binwidth will be chosen so that approximately 10 bins cover the data. adjust
can be used to to increase or decrease binwidth
.NA
, the default, includes if any aesthetics are mapped.
FALSE
never includes, and TRUE
always includes.FALSE
, overrides the default aesthetics,
rather than combining with them. This is most useful for helper functions that
define both data and aesthetics and shouldn't inherit behaviour from the default plot
specification, e.g. borders
.StatAsh
(inherits from Stat
, ggproto
) of length 3.ashplot( ~age | substance, groups = sex, data = HELPrct)
ggplot(faithful, aes(x = eruptions)) +
geom_histogram(aes(y = ..density..),
fill = "lightskyblue", colour = "gray50", alpha = 0.2) +
geom_ash(colour = "red") +
geom_ash(colour = "forestgreen", adjust = 2) +
geom_ash(colour = "navy", adjust = 1/2) +
theme_minimal()
Run the code above in your browser using DataLab