Browse Source

position_jitter_on_equal

noproj
boB Rudis 3 years ago
parent
commit
19e04a3fc0
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 3
      DESCRIPTION
  2. 2
      NAMESPACE
  3. 19
      R/geom_dumbbell.R
  4. 41
      R/position-jitter-on-equal.R
  5. 10
      man/absoluteGrob.Rd
  6. 22
      man/annotate_textp.Rd
  7. 19
      man/annotation_ticks.Rd
  8. 3
      man/byte_format.Rd
  9. 50
      man/geom_bkde.Rd
  10. 54
      man/geom_bkde2d.Rd
  11. 43
      man/geom_dumbbell.Rd
  12. 13
      man/geom_encircle.Rd
  13. 30
      man/geom_horizon.Rd
  14. 24
      man/geom_lollipop.Rd
  15. 29
      man/geom_spikelines.Rd
  16. 42
      man/geom_stateface.Rd
  17. 23
      man/geom_ubar.Rd
  18. 51
      man/geom_xspline.Rd
  19. 28
      man/geom_xspline2.Rd
  20. 1
      man/ggalt.Rd
  21. 4
      man/ggplot2-ggproto.Rd
  22. 5
      man/load_stateface.Rd
  23. 16
      man/position_jitter_on_equal.Rd
  24. 5
      man/show_stateface.Rd
  25. 29
      man/stat_ash.Rd
  26. 26
      man/stat_stepribbon.Rd

3
DESCRIPTION

@ -53,7 +53,7 @@ Imports:
MASS,
extrafont,
plotly (>= 3.4.1)
RoxygenNote: 6.1.1
RoxygenNote: 7.1.1
VignetteBuilder: knitr
Collate:
'annotate_textp.r'
@ -61,6 +61,7 @@ Collate:
'formatters.r'
'fortify.r'
'position-dodgev.R'
'position-jitter-on-equal.R'
'geom2plotly.r'
'geom_ash.r'
'geom_bkde.r'

2
NAMESPACE

@ -22,6 +22,7 @@ export(GeomXspline)
export(Kb)
export(Mb)
export(PositionDodgev)
export(PositionJitterOnEqual)
export(StatAsh)
export(StatBkde)
export(StatBkde2d)
@ -44,6 +45,7 @@ export(geom_ubar)
export(geom_xspline)
export(load_stateface)
export(position_dodgev)
export(position_jitter_on_equal)
export(show_stateface)
export(stat_ash)
export(stat_bkde)

19
R/geom_dumbbell.R

@ -19,7 +19,10 @@
#' @param shape_x,shape_xend shape to use for x/xend; defaults to 19
#' @param fill_x,fill_xend fill for x/xend if the shape is hollow; defaults to fill aes
#' @param dot_guide if \code{TRUE}, a leading dotted line will be placed before the left-most dumbbell point
#' @param dot_guide_size,dot_guide_colour singe-value aesthetics for \code{dot_guide}
#' @param dot_guide_size,dot_guide_colour singe-value ahesthetics for \code{dot_guide}
#' @param jitter_on_equal_values numeric value [0..1], default is 0. If non-zero and if both
#' values are equal, jitter the points vertically by the amount specified so
#' they don't fully overlap.
#' @param position Position adjustment, either as a string, or the result of a
#' call to a position adjustment function.
#' @inheritParams ggplot2::layer
@ -66,7 +69,7 @@ geom_dumbbell <- function(mapping = NULL, data = NULL, ...,
colour_x = NULL, size_x = NULL, shape_x = NULL, fill_x = NULL,
colour_xend = NULL, size_xend = NULL, shape_xend = NULL, fill_xend = NULL,
dot_guide = FALSE, dot_guide_size = NULL,
dot_guide_colour = NULL,
dot_guide_colour = NULL, jitter_on_equal_values = 0,
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE,
position = "identity") {
@ -91,6 +94,7 @@ geom_dumbbell <- function(mapping = NULL, data = NULL, ...,
dot_guide = dot_guide,
dot_guide_size = dot_guide_size,
dot_guide_colour = dot_guide_colour,
jitter_on_equal_values = jitter_on_equal_values,
...
)
)
@ -105,23 +109,25 @@ GeomDumbbell <- ggproto("GeomDumbbell", Geom,
non_missing_aes = c("size", "shape",
"colour_x", "size_x", "shape_x", "fill_x",
"colour_xend", "size_xend", "shape_xend", "fill_xend",
"dot_guide", "dot_guide_size", "dot_guide_colour"),
"dot_guide", "dot_guide_size", "dot_guide_colour",
"jitter_on_equal_values"),
default_aes = aes(
shape = 19, colour = "black", size = 0.5, fill = NA,
alpha = NA, stroke = 0.5
),
setup_data = function(data, params) {
transform(data, yend = y)
transform(data, point_y = y, yend = y, dot_yend = y)
},
draw_group = function(data, panel_scales, coord,
colour_x = NULL, size_x = NULL, shape_x = NULL, fill_x = NULL,
colour_xend = NULL, size_xend = NULL, shape_xend = NULL, fill_xend = NULL,
dot_guide = NULL, dot_guide_size = NULL,
dot_guide_colour = NULL) {
dot_guide_colour = NULL, jitter_on_equal_values) {
points.x <- data
points.x$y <- points.x$point_y
points.x$colour <- colour_x %||% data$colour
points.x$fill <- fill_x %||% data$fill
points.x$shape <- shape_x %||% 19
@ -129,6 +135,7 @@ GeomDumbbell <- ggproto("GeomDumbbell", Geom,
points.x$size <- size_x %||% (data$size * 1.2)
points.xend <- data
points.xend.y <- points.xend$yend
points.xend$x <- points.xend$xend
points.xend$colour <- colour_xend %||% data$colour
points.xend$fill <- fill_xend %||% data$fill
@ -139,6 +146,7 @@ GeomDumbbell <- ggproto("GeomDumbbell", Geom,
dot_df <- data
dot_df$xend <- ifelse(data$xend < data$x, data$xend, data$x)
dot_df$yend <- dot_df$dot_yend
dot_df$x <- -Inf
dot_df$linetype <- "11"
dot_df$size <- dot_guide_size %||% (data$size * 0.5)
@ -166,6 +174,7 @@ GeomDumbbell <- ggproto("GeomDumbbell", Geom,
},
draw_key = draw_key_point
)

41
R/position-jitter-on-equal.R

@ -0,0 +1,41 @@
#' Jitter points to avoid overplotting
#'
#' Designed primarily for [geom_dumbbell()] to jitter the second point vertically
#' when both x values are equal.
#'
#' @family position adjustments
#' @param amount Amount of vertical jitter (0..1)
#' @export
position_jitter_on_equal <- function(amount = 0) {
ggproto(
NULL,
PositionJitterOnEqual,
amount = amount
)
}
#' @rdname ggplot2-ggproto
#' @format NULL
#' @usage NULL
#' @export
PositionJitterOnEqual <- ggproto(
"PositionJitterOnEqual", Position,
required_aes = c("x", "y"),
setup_params = function(self, data) {
list(
amount = self$amount
)
},
compute_layer = function(self, data, params, layout) {
data[data$x == data$xend,]$point_y <-
data[data$x == data$xend,]$point_y + (data[data$x == data$xend,]$point_y * params$amount)
data
}
)

10
man/absoluteGrob.Rd

@ -4,8 +4,14 @@
\alias{absoluteGrob}
\title{Absolute grob}
\usage{
absoluteGrob(grob, width = NULL, height = NULL, xmin = NULL,
ymin = NULL, vp = NULL)
absoluteGrob(
grob,
width = NULL,
height = NULL,
xmin = NULL,
ymin = NULL,
vp = NULL
)
}
\description{
This grob has fixed dimensions and position.

22
man/annotate_textp.Rd

@ -4,10 +4,22 @@
\alias{annotate_textp}
\title{Text annotations in plot coordinate system}
\usage{
annotate_textp(label, x, y, facets = NULL, hjust = 0, vjust = 0,
color = "black", alpha = NA, family = theme_get()$text$family,
size = theme_get()$text$size, fontface = 1, lineheight = 1,
box_just = ifelse(c(x, y) < 0.5, 0, 1), margin = unit(size/2, "pt"))
annotate_textp(
label,
x,
y,
facets = NULL,
hjust = 0,
vjust = 0,
color = "black",
alpha = NA,
family = theme_get()$text$family,
size = theme_get()$text$size,
fontface = 1,
lineheight = 1,
box_just = ifelse(c(x, y) < 0.5, 0, 1),
margin = unit(size/2, "pt")
)
}
\arguments{
\item{label}{text annotation to be placed on the plot}
@ -39,5 +51,5 @@ instead of data coordinates.
\examples{
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point()
p <- p + geom_smooth(method = "lm", se = FALSE)
p + annotate_textp(x = 0.9, y = 0.35, label="A relative linear\\nrelationship", hjust=1, color="red")
p + annotate_textp(x = 0.9, y = 0.35, label="A relative linear\nrelationship", hjust=1, color="red")
}

19
man/annotation_ticks.Rd

@ -4,10 +4,21 @@
\alias{annotation_ticks}
\title{Annotation: tick marks}
\usage{
annotation_ticks(sides = "b", scale = "identity", scaled = TRUE,
short = unit(0.1, "cm"), mid = unit(0.2, "cm"), long = unit(0.3,
"cm"), colour = "black", size = 0.5, linetype = 1, alpha = 1,
color = NULL, ticks_per_base = NULL, ...)
annotation_ticks(
sides = "b",
scale = "identity",
scaled = TRUE,
short = unit(0.1, "cm"),
mid = unit(0.2, "cm"),
long = unit(0.3, "cm"),
colour = "black",
size = 0.5,
linetype = 1,
alpha = 1,
color = NULL,
ticks_per_base = NULL,
...
)
}
\arguments{
\item{sides}{a string that controls which sides of the plot the log ticks appear on.

3
man/byte_format.Rd

@ -16,8 +16,7 @@ Mb(x)
Gb(x)
bytes(x, symbol = "auto", units = c("binary", "si"),
only_highest = FALSE)
bytes(x, symbol = "auto", units = c("binary", "si"), only_highest = FALSE)
}
\arguments{
\item{symbol}{byte symbol to use. If "\code{auto}" the symbol used will be

50
man/geom_bkde.Rd

@ -5,19 +5,39 @@
\alias{stat_bkde}
\title{Display a smooth density estimate.}
\usage{
geom_bkde(mapping = NULL, data = NULL, stat = "bkde",
position = "identity", bandwidth = NULL, range.x = NULL,
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
stat_bkde(mapping = NULL, data = NULL, geom = "area",
position = "stack", kernel = "normal", canonical = FALSE,
bandwidth = NULL, gridsize = 410, range.x = NULL,
truncate = TRUE, na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...)
geom_bkde(
mapping = NULL,
data = NULL,
stat = "bkde",
position = "identity",
bandwidth = NULL,
range.x = NULL,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
stat_bkde(
mapping = NULL,
data = NULL,
geom = "area",
position = "stack",
kernel = "normal",
canonical = FALSE,
bandwidth = NULL,
gridsize = 410,
range.x = NULL,
truncate = TRUE,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -25,11 +45,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -59,9 +79,9 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[=layer]{layer()}}. These are
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}

54
man/geom_bkde2d.Rd

@ -5,20 +5,42 @@
\alias{stat_bkde2d}
\title{Contours from a 2d density estimate.}
\usage{
geom_bkde2d(mapping = NULL, data = NULL, stat = "bkde2d",
position = "identity", bandwidth = NULL, range.x = NULL,
lineend = "butt", contour = TRUE, linejoin = "round",
linemitre = 1, na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...)
stat_bkde2d(mapping = NULL, data = NULL, geom = "density2d",
position = "identity", contour = TRUE, bandwidth = NULL,
grid_size = c(51, 51), range.x = NULL, truncate = TRUE,
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
geom_bkde2d(
mapping = NULL,
data = NULL,
stat = "bkde2d",
position = "identity",
bandwidth = NULL,
range.x = NULL,
lineend = "butt",
contour = TRUE,
linejoin = "round",
linemitre = 1,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
stat_bkde2d(
mapping = NULL,
data = NULL,
geom = "density2d",
position = "identity",
contour = TRUE,
bandwidth = NULL,
grid_size = c(51, 51),
range.x = NULL,
truncate = TRUE,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -26,11 +48,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -73,9 +95,9 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[=layer]{layer()}}. These are
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}

43
man/geom_dumbbell.Rd

@ -4,16 +4,31 @@
\alias{geom_dumbbell}
\title{Dumbbell charts}
\usage{
geom_dumbbell(mapping = NULL, data = NULL, ..., colour_x = NULL,
size_x = NULL, shape_x = NULL, fill_x = NULL, colour_xend = NULL,
size_xend = NULL, shape_xend = NULL, fill_xend = NULL,
dot_guide = FALSE, dot_guide_size = NULL, dot_guide_colour = NULL,
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE,
position = "identity")
geom_dumbbell(
mapping = NULL,
data = NULL,
...,
colour_x = NULL,
size_x = NULL,
shape_x = NULL,
fill_x = NULL,
colour_xend = NULL,
size_xend = NULL,
shape_xend = NULL,
fill_xend = NULL,
dot_guide = FALSE,
dot_guide_size = NULL,
dot_guide_colour = NULL,
jitter_on_equal_values = 0,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
position = "identity"
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -21,11 +36,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -47,7 +62,11 @@ to the paired geom/stat.}
\item{dot_guide}{if \code{TRUE}, a leading dotted line will be placed before the left-most dumbbell point}
\item{dot_guide_size, dot_guide_colour}{singe-value aesthetics for \code{dot_guide}}
\item{dot_guide_size, dot_guide_colour}{singe-value ahesthetics for \code{dot_guide}}
\item{jitter_on_equal_values}{numeric value [0..1], default is 0. If non-zero and if both
values are equal, jitter the points vertically by the amount specified so
they don't fully overlap.}
\item{na.rm}{If \code{FALSE} (the default), removes missing values with
a warning. If \code{TRUE} silently removes missing values.}
@ -61,7 +80,7 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
\item{position}{Position adjustment, either as a string, or the result of a
call to a position adjustment function.}

13
man/geom_encircle.Rd

@ -4,9 +4,16 @@
\alias{geom_encircle}
\title{Automatically enclose points in a polygon}
\usage{
geom_encircle(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...)
geom_encircle(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{mapping}

30
man/geom_horizon.Rd

@ -7,16 +7,34 @@
\alias{stat_horizon}
\alias{StatHorizon}
\title{Plot a time series as a horizon plot}
\format{An object of class \code{GeomHorizon} (inherits from \code{GeomArea}, \code{GeomRibbon}, \code{Geom}, \code{ggproto}, \code{gg}) of length 4.}
\format{
An object of class \code{GeomHorizon} (inherits from \code{GeomArea}, \code{GeomRibbon}, \code{Geom}, \code{ggproto}, \code{gg}) of length 4.
An object of class \code{StatHorizon} (inherits from \code{Stat}, \code{ggproto}, \code{gg}) of length 5.
}
\usage{
geom_horizon(mapping = NULL, data = NULL, show.legend = TRUE,
inherit.aes = TRUE, na.rm = TRUE, bandwidth = NULL, ...)
geom_horizon(
mapping = NULL,
data = NULL,
show.legend = TRUE,
inherit.aes = TRUE,
na.rm = TRUE,
bandwidth = NULL,
...
)
GeomHorizon
stat_horizon(mapping = NULL, data = NULL, geom = "horizon",
show.legend = TRUE, inherit.aes = TRUE, na.rm = TRUE,
bandwidth = NULL, ...)
stat_horizon(
mapping = NULL,
data = NULL,
geom = "horizon",
show.legend = TRUE,
inherit.aes = TRUE,
na.rm = TRUE,
bandwidth = NULL,
...
)
StatHorizon
}

24
man/geom_lollipop.Rd

@ -4,13 +4,21 @@
\alias{geom_lollipop}
\title{Lollipop charts}
\usage{
geom_lollipop(mapping = NULL, data = NULL, ..., horizontal = FALSE,
point.colour = NULL, point.size = NULL, na.rm = FALSE,
show.legend = NA, inherit.aes = TRUE)
geom_lollipop(
mapping = NULL,
data = NULL,
...,
horizontal = FALSE,
point.colour = NULL,
point.size = NULL,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -18,11 +26,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -57,7 +65,7 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
}
\description{
The lollipop geom is used to create lollipop charts.

29
man/geom_spikelines.Rd

@ -4,14 +4,23 @@
\alias{geom_spikelines}
\title{Draw spikelines on a plot}
\usage{
geom_spikelines(mapping = NULL, data = NULL, stat = "identity",
position = "identity", ..., arrow = NULL, lineend = "butt",
linejoin = "round", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE)
geom_spikelines(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
arrow = NULL,
lineend = "butt",
linejoin = "round",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -19,11 +28,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -36,7 +45,7 @@ layer, as a string.}
\item{position}{Position adjustment, either as a string, or the result of
a call to a position adjustment function.}
\item{...}{Other arguments passed on to \code{\link[=layer]{layer()}}. These are
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
@ -59,7 +68,7 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
}
\description{
Segment reference lines that originate at an point

42
man/geom_stateface.Rd

@ -4,14 +4,24 @@
\alias{geom_stateface}
\title{Use ProPublica's StateFace font in ggplot2 plots}
\usage{
geom_stateface(mapping = NULL, data = NULL, stat = "identity",
position = "identity", ..., parse = FALSE, nudge_x = 0,
nudge_y = 0, check_overlap = FALSE, na.rm = FALSE,
show.legend = NA, inherit.aes = TRUE)
geom_stateface(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
parse = FALSE,
nudge_x = 0,
nudge_y = 0,
check_overlap = FALSE,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -19,11 +29,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -34,9 +44,10 @@ from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
layer, as a string.}
\item{position}{Position adjustment, either as a string, or the result of
a call to a position adjustment function.}
a call to a position adjustment function. Cannot be jointy specified with
\code{nudge_x} or \code{nudge_y}.}
\item{...}{Other arguments passed on to \code{\link[=layer]{layer()}}. These are
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
@ -49,7 +60,9 @@ abels by. Useful for offsetting text from points, particularly
on discrete scales.}
\item{check_overlap}{If \code{TRUE}, text that overlaps previous text in the
same layer will not be plotted.}
same layer will not be plotted. \code{check_overlap} happens at draw time and in
the order of the data. Therefore data should be arranged by the label
column before calling \code{geom_label()} or \code{geom_text()}.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
@ -63,7 +76,7 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
}
\description{
The \code{label} parameter can be either a 2-letter state abbreviation
@ -114,7 +127,8 @@ gg
}
}
\seealso{
Other StateFace operations: \code{\link{load_stateface}},
\code{\link{show_stateface}}
Other StateFace operations:
\code{\link{load_stateface}()},
\code{\link{show_stateface}()}
}
\concept{StateFace operations}

23
man/geom_ubar.Rd

@ -4,13 +4,20 @@
\alias{geom_ubar}
\title{Uniform "bar" charts}
\usage{
geom_ubar(mapping = NULL, data = NULL, stat = "identity",
position = "identity", ..., na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE)
geom_ubar(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -18,11 +25,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -52,7 +59,7 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
}
\description{
I've been using \code{geom_segment} more to make "bar" charts, setting

51
man/geom_xspline.Rd

@ -5,19 +5,37 @@
\alias{stat_xspline}
\title{Connect control points/observations with an X-spline}
\usage{
geom_xspline(mapping = NULL, data = NULL, stat = "xspline",
position = "identity", na.rm = TRUE, show.legend = NA,
inherit.aes = TRUE, spline_shape = -0.25, open = TRUE,
rep_ends = TRUE, ...)
stat_xspline(mapping = NULL, data = NULL, geom = "line",
position = "identity", na.rm = TRUE, show.legend = NA,
inherit.aes = TRUE, spline_shape = -0.25, open = TRUE,
rep_ends = TRUE, ...)
geom_xspline(
mapping = NULL,
data = NULL,
stat = "xspline",
position = "identity",
na.rm = TRUE,
show.legend = NA,
inherit.aes = TRUE,
spline_shape = -0.25,
open = TRUE,
rep_ends = TRUE,
...
)
stat_xspline(
mapping = NULL,
data = NULL,
geom = "line",
position = "identity",
na.rm = TRUE,
show.legend = NA,
inherit.aes = TRUE,
spline_shape = -0.25,
open = TRUE,
rep_ends = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -25,11 +43,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -51,7 +69,7 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
\item{spline_shape}{A numeric vector of values between -1 and 1, which
control the shape of the spline relative to the control points.}
@ -63,7 +81,7 @@ closed shape.}
first and last control points should be replicated for drawing the
curve. Ignored for closed X-splines.}
\item{...}{Other arguments passed on to \code{\link[=layer]{layer()}}. These are
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
@ -194,6 +212,7 @@ Blanc, C. and Schlick, C. (1995), "X-splines : A Spline Model
\code{\link[graphics]{xspline}};
\code{\link[grid]{grid.xspline}}
Other xspline implementations: \code{\link{geom_xspline2}}
Other xspline implementations:
\code{\link{geom_xspline2}()}
}
\concept{xspline implementations}

28
man/geom_xspline2.Rd

@ -5,13 +5,20 @@
\title{Alternative implemenation for connecting control points/observations
with an X-spline}
\usage{
geom_xspline2(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...)
geom_xspline2(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -19,11 +26,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -48,9 +55,9 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[=layer]{layer()}}. These are
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
@ -63,7 +70,8 @@ Alternative implemenation for connecting control points/observations
with an X-spline
}
\seealso{
Other xspline implementations: \code{\link{geom_xspline}}
Other xspline implementations:
\code{\link{geom_xspline}()}
}
\author{
Ben Bolker

1
man/ggalt.Rd

@ -3,7 +3,6 @@
\docType{package}
\name{ggalt}
\alias{ggalt}
\alias{ggalt-package}
\title{Extra Geoms, Stats, Coords, Scales & Fonts for 'ggplot2'}
\description{
A package containing additional geoms, coords, stats, scales & fonts

4
man/ggplot2-ggproto.Rd

@ -1,8 +1,10 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/annotation_ticks.r
% Please edit documentation in R/annotation_ticks.r,
% R/position-jitter-on-equal.R
\docType{data}
\name{GeomTicks}
\alias{GeomTicks}
\alias{PositionJitterOnEqual}
\title{Base ggproto classes for ggplot2}
\description{
If you are creating a new geom, stat, position, or scale in another package,

5
man/load_stateface.Rd

@ -11,7 +11,8 @@ Makes the ProPublica StateFace font available to PDF, PostScript,
et. al. devices.
}
\seealso{
Other StateFace operations: \code{\link{geom_stateface}},
\code{\link{show_stateface}}
Other StateFace operations:
\code{\link{geom_stateface}()},
\code{\link{show_stateface}()}
}
\concept{StateFace operations}

16
man/position_jitter_on_equal.Rd

@ -0,0 +1,16 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/position-jitter-on-equal.R
\name{position_jitter_on_equal}
\alias{position_jitter_on_equal}
\title{Jitter points to avoid overplotting}
\usage{
position_jitter_on_equal(amount = 0)
}
\arguments{
\item{amount}{Amount of vertical jitter (0..1)}
}
\description{
Designed primarily for [geom_dumbbell()] to jitter the second point vertically
when both x values are equal.
}
\concept{position adjustments}

5
man/show_stateface.Rd

@ -12,7 +12,8 @@ in the on-screen plot device for ggplot2, you need to install
the font on your system
}
\seealso{
Other StateFace operations: \code{\link{geom_stateface}},
\code{\link{load_stateface}}
Other StateFace operations:
\code{\link{geom_stateface}()},
\code{\link{load_stateface}()}
}
\concept{StateFace operations}

29
man/stat_ash.Rd

@ -4,13 +4,24 @@
\alias{stat_ash}
\title{Compute and display a univariate averaged shifted histogram (polynomial kernel)}
\usage{
stat_ash(mapping = NULL, data = NULL, geom = "area",
position = "stack", ab = NULL, nbin = 50, m = 5, kopt = c(2,
2), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
stat_ash(
mapping = NULL,
data = NULL,
geom = "area",
position = "stack",
ab = NULL,
nbin = 50,
m = 5,
kopt = c(2, 2),
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -18,11 +29,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -58,9 +69,9 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[=layer]{layer()}}. These are
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}

26
man/stat_stepribbon.Rd

@ -4,13 +4,21 @@
\alias{stat_stepribbon}
\title{Step ribbon statistic}
\usage{
stat_stepribbon(mapping = NULL, data = NULL, geom = "ribbon",
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, direction = "hv", ...)
stat_stepribbon(
mapping = NULL,
data = NULL,
geom = "ribbon",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
direction = "hv",
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[=aes]{aes()}} or
\code{\link[=aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}} or
\code{\link[ggplot2:aes_]{aes_()}}. If specified and \code{inherit.aes = TRUE} (the
default), it is combined with the default mapping at the top level of the
plot. You must supply \code{mapping} if there is no plot mapping.}
@ -18,11 +26,11 @@ plot. You must supply \code{mapping} if there is no plot mapping.}
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[=ggplot]{ggplot()}}.
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[=fortify]{fortify()}} for which variables will be created.
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
@ -46,12 +54,12 @@ display.}
\item{inherit.aes}{If \code{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. \code{\link[=borders]{borders()}}.}
the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.}
\item{direction}{\code{hv} for horizontal-veritcal steps, \code{vh} for
vertical-horizontal steps}
\item{...}{Other arguments passed on to \code{\link[=layer]{layer()}}. These are
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}

Loading…
Cancel
Save