An ASH plot is the average over all histograms of a fixed bin width.
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, ...)
a formula or numeric vector
additional arguments passed to panel and prepanel functions or data
, a
data frame in which to find the variales used for the plot.
the historam bin width.
a numeric adjustment to width
. Primarily useful when width
is
not specified. Increasing adjust
makes the plot smoother.
a panel funtion
a prepanel function
a list of arguments for the function computing the ASH.
as in other lattice plots
as in other lattice prepanel functions
One of TRUE
, FALSE
, "jitter"
, or "rug"
a logical indicating whether a reference line should be displayed
when plot.points="jitter"
, the value to use as the amount
argument to jitter
.
type argument used to plot points, if requested.
This is not expected to be useful, it is available mostly to protect a type
argument,
if specified, from affecting the display of the ASH.
A character string that is prepended to the names of i grobs that are created by this panel function.
the width of the histogram bins. If 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
.
a data frame
a geom to use for this layer, as a string.
position adjustment, either as a string or the result of a call to a position adjustment function.
If FALSE (the default), removes missing values with a warning. If TRUE silently removes missing values.
logical. Should this layer be included in the legends?
NA
, the default, includes if any aesthetics are mapped.
FALSE
never includes, and TRUE
always includes.
If 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
.
a statistical transformation to use on the data for this layer, as a string.
a data frame containing x and y coordinates of the resulting ASH plot.
An object of class StatAsh
(inherits from Stat
, ggproto
) of length 3.
# NOT RUN {
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