Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Roxygenise, fixing bugs

  • Loading branch information...
commit c0af4ae659b996fcfddfa9d012eb2c80d695f161 1 parent 83e8f8f
@hadley authored
Showing with 948 additions and 74 deletions.
  1. +37 −3 DESCRIPTION
  2. +80 −0 NAMESPACE
  3. +1 −0  R/geom-step.r
  4. +3 −3 R/geom-text.r
  5. +3 −14 R/layer.r
  6. +27 −27 R/stat-bin.r
  7. +21 −21 R/stat-bin2d.r
  8. +8 −6 R/stat-density.r
  9. +15 −0 man/add_group.Rd
  10. +12 −0 man/adjust_fill.Rd
  11. +10 −0 man/adjust_stack.Rd
  12. +10 −0 man/aes_all.Rd
  13. +16 −0 man/aes_default.Rd
  14. +13 −0 man/aes_icon.Rd
  15. +15 −0 man/aes_present.Rd
  16. +15 −0 man/aes_required.Rd
  17. +10 −0 man/build_defaults.Rd
  18. +21 −0 man/calc_aesthetics.Rd
  19. +11 −0 man/check_aesthetic_params.Rd
  20. +11 −0 man/check_missing_aesthetics.Rd
  21. +10 −0 man/check_required_aesthetics.Rd
  22. +29 −0 man/geom_bar.Rd
  23. +25 −0 man/geom_data.Rd
  24. +12 −0 man/geom_deparse.Rd
  25. +21 −0 man/geom_grob.Rd
  26. +25 −0 man/geom_line.Rd
  27. +26 −0 man/geom_munch.Rd
  28. +10 −0 man/geom_munch.rect.Rd
  29. +10 −0 man/geom_name.Rd
  30. +38 −0 man/geom_path.Rd
  31. +13 −0 man/geom_plot.Rd
  32. +18 −0 man/geom_point.Rd
  33. +27 −0 man/geom_polygon.Rd
  34. +10 −0 man/geom_rect.Rd
  35. +24 −0 man/geom_ribbon.Rd
  36. +13 −0 man/geom_rug.Rd
  37. +28 −0 man/geom_segment.Rd
  38. +18 −0 man/geom_stat.Rd
  39. +20 −0 man/geom_step.Rd
  40. +30 −0 man/geom_text.Rd
  41. +10 −0 man/geom_visualise.Rd
  42. +9 −0 man/layers.Rd
  43. +23 −0 man/parse_dots.Rd
  44. +33 −0 man/stat_contour.Rd
  45. +34 −0 man/stat_density.Rd
  46. +26 −0 man/stat_density2d.Rd
  47. +18 −0 man/stat_densitypoint.Rd
  48. +10 −0 man/stat_identity.Rd
  49. +24 −0 man/stat_sum.Rd
  50. +15 −0 man/stat_transform.densitypoint.Rd
View
40 DESCRIPTION
@@ -4,8 +4,42 @@ Title: Layer related components from ggplot2
Version: 0.0.0
Author: Hadley Wickham <h.wickham@gmail.com>
Maintainer: Hadley Wickham <h.wickham@gmail.com>
-Description:
-Depends: R (>= 2.12)
-Imports: grid, scales, plyr
+Description:
+Depends:
+ R (>= 2.12)
+Imports:
+ grid,
+ scales,
+ plyr
License: MIT
LazyLoad: yes
+Collate:
+ 'adjust-fill.r'
+ 'adjust-stack.r'
+ 'adjust.r'
+ 'aesthetics-defaults.r'
+ 'aesthetics-group.r'
+ 'aesthetics.r'
+ 'geom-bar.r'
+ 'geom-line.r'
+ 'geom-path.r'
+ 'geom-point.r'
+ 'geom-polygon.r'
+ 'geom-rect.r'
+ 'geom-ribbon.r'
+ 'geom-rug.r'
+ 'geom-segment.r'
+ 'geom-step.r'
+ 'geom-text.r'
+ 'geom.r'
+ 'layer-defaults.r'
+ 'layer.r'
+ 'scaled-values.r'
+ 'stat-contour.r'
+ 'stat-density-point.r'
+ 'stat-density.r'
+ 'stat-density2d.r'
+ 'stat-identity.r'
+ 'stat-sum.r'
+ 'stat.r'
+ 'utils.r'
View
80 NAMESPACE
@@ -0,0 +1,80 @@
+export(aes_all)
+export(aes_default)
+export(aes_icon)
+export(aes_present)
+export(aes_required)
+export(build_defaults)
+export(geom_adjust)
+export(geom_bar)
+export(geom_data)
+export(geom_line)
+export(geom_munch)
+export(geom_name)
+export(geom_path)
+export(geom_plot)
+export(geom_point)
+export(geom_rect)
+export(geom_ribbon)
+export(geom_rug)
+export(geom_segment)
+export(geom_stat)
+export(geom_step)
+export(geom_text)
+export(geom_visualise)
+export(stat_contour)
+export(stat_density)
+export(stat_identity)
+export(stat_sum)
+import(plyr)
+import(scales)
+importFrom(MASS,kde2d)
+S3method(aes_default,bar)
+S3method(aes_default,path)
+S3method(aes_default,rect)
+S3method(aes_default,ribbon)
+S3method(aes_default,segment)
+S3method(aes_defaults,text)
+S3method(aes_present,density)
+S3method(aes_present,path)
+S3method(aes_required,bar)
+S3method(aes_required,contour)
+S3method(aes_required,density)
+S3method(aes_required,geom)
+S3method(aes_required,identity)
+S3method(aes_required,path)
+S3method(aes_required,rect)
+S3method(aes_required,ribbon)
+S3method(aes_required,segment)
+S3method(aes_required,text)
+S3method(geom_adjust,bar)
+S3method(geom_adjust,default)
+S3method(geom_data,default)
+S3method(geom_data,line)
+S3method(geom_data,path)
+S3method(geom_data,step)
+S3method(geom_grob,bar)
+S3method(geom_grob,path)
+S3method(geom_grob,rect)
+S3method(geom_grob,ribbon)
+S3method(geom_grob,rug)
+S3method(geom_grob,segment)
+S3method(geom_grob,text)
+S3method(geom_munch,bar)
+S3method(geom_munch,default)
+S3method(geom_munch,rect)
+S3method(geom_munch,segment)
+S3method(geom_stat,bar)
+S3method(geom_stat,default)
+S3method(geom_visaulise,text)
+S3method(geom_visualise,bar)
+S3method(geom_visualise,default)
+S3method(geom_visualise,line)
+S3method(geom_visualise,path)
+S3method(geom_visualise,rect)
+S3method(geom_visualise,ribbon)
+S3method(geom_visualise,segment)
+S3method(geom_visualise,step)
+S3method(stat_transform,contour)
+S3method(stat_transform,density)
+S3method(stat_transform,identity)
+S3method(stat_transform,sum)
View
1  R/geom-step.r
@@ -7,6 +7,7 @@
#' @export
#' @S3method geom_data step
#' @S3method geom_visualise step
+#' @examples
#' df <- data.frame(x = 1:10, y = 1:10)
#' geom_plot(geom_step(), df)
#' geom_plot(geom_step(direction = "vh"), df)
View
6 R/geom-text.r
@@ -8,9 +8,9 @@
#' @export
#' @S3method aes_required text
#' @S3method aes_defaults text
-#' @S3meothd geom_grob text
-#' @S3meothd geom_visaulise text
-#' @example
+#' @S3method geom_grob text
+#' @S3method geom_visaulise text
+#' @examples
#' df <- data.frame(x = 1:5, y = 1:5, label = letters[1:5])
#' geom_plot(geom_text(), df)
#' geom_plot(geom_text(list(angle = 45)), df)
View
17 R/layer.r
@@ -1,9 +1,8 @@
#' The layers package.
#'
-#' @imports scales plyr
-#' @doctype package
+#' @import scales plyr
+#' @docType package
#' @name layers
-#' @aliases layers package-layers
NULL
geom_from_layer <- function(name, call = NULL) {
@@ -70,23 +69,13 @@ layer <- function() {
}
-#' Generates parameter description for a geom-layer.
+# Generates parameter description for a geom-layer.
rd_geom_params <- function(geom) {
# Parse documentation and extract parameters
# Add extra description for mapping, data, and ... (including a list of
# all valid aesthetics)
}
-#' @param inherit.aes
-#' @param legend single logical value. If \code{TRUE} forces display of this
-#' layer on the legend, if \code{FALSE} never displays, if \code{NA}
-#' only if it shows data.
-#' @param train.limits if \code{FALSE} data on this layer will not affect
-#' scale limits
-#' @param subset a quoted expression giving a subset expression to use to
-#' subset the dta
-
-
build_layer <- function(mapping, data, geom, stat, adjust, params, geom.params, stat.params) {
args <- parse_dots(list(...), stat = stat, position = position)
View
54 R/stat-bin.r
@@ -38,30 +38,30 @@
#' # Also works with categorical variables
#' ggplot(movies, aes(x=mpaa)) + stat_bin()
#' qplot(mpaa, data=movies, stat="bin")
-StatBin <- proto(Stat, {
- objname <- "bin"
-
- informed <- FALSE
-
- calculate_groups <- function(., data, ...) {
- .$informed <- FALSE
- .super$calculate_groups(., data, ...)
- }
-
- calculate <- function(., data, scales, bins = 30, binwidth=NULL, origin=NULL, breaks=NULL, width=0.9, drop = FALSE, right = TRUE, ...) {
- range <- scales$x$output_set()
-
- if (!is.null(breaks)) {
- breaks <- interval_breaks(bins, binwidth, origin)
- }
- open <- if (right) "right" else "left"
-
- bin_interval(data$x, data$weight, breaks = breaks, open = open)
- }
-
- icon <- function(.) GeomHistogram$icon()
- default_aes <- function(.) aes(y = ..count..)
- required_aes <- c("x")
- default_geom <- function(.) GeomBar
-
-})
+# StatBin <- proto(Stat, {
+# objname <- "bin"
+#
+# informed <- FALSE
+#
+# calculate_groups <- function(., data, ...) {
+# .$informed <- FALSE
+# .super$calculate_groups(., data, ...)
+# }
+#
+# calculate <- function(., data, scales, bins = 30, binwidth=NULL, origin=NULL, breaks=NULL, width=0.9, drop = FALSE, right = TRUE, ...) {
+# range <- scales$x$output_set()
+#
+# if (!is.null(breaks)) {
+# breaks <- interval_breaks(bins, binwidth, origin)
+# }
+# open <- if (right) "right" else "left"
+#
+# bin_interval(data$x, data$weight, breaks = breaks, open = open)
+# }
+#
+# icon <- function(.) GeomHistogram$icon()
+# default_aes <- function(.) aes(y = ..count..)
+# required_aes <- c("x")
+# default_geom <- function(.) GeomBar
+#
+# })
View
42 R/stat-bin2d.r
@@ -27,24 +27,24 @@
#' xlim = c(4, 10), ylim = c(4, 10))
#' qplot(x, y, data = diamonds, geom="bin2d", binwidth = c(0.1, 0.1),
#' xlim = c(4, 10), ylim = c(4, 10))
-StatBin2d <- proto(Stat, {
- objname <- "bin2d"
-
- default_aes <- function(.) aes(fill = ..count..)
- required_aes <- c("x", "y")
- default_geom <- function(.) GeomRect
-
- calculate <- function(., data, scales, binwidth = NULL, bins = c(30, 30), breaks = NULL, origin = NULL, drop = TRUE, ...) {
-
- bins <- bin_rect(data$x, data$y, data$weight,
- xbreaks = interval_breaks(bins[1], binwidth[1],
- range = scales$x$output_set()),
- ybreaks = interval_breaks(bins[2], binwidth[2],
- range = scales$y$output_set()),
- )
-
- if (drop) bins <- bins[bins$count > 0, ]
- bins$density <- bin$count / sum(bin$count, na.rm = TRUE)
- bins
- }
-})
+# StatBin2d <- proto(Stat, {
+# objname <- "bin2d"
+#
+# default_aes <- function(.) aes(fill = ..count..)
+# required_aes <- c("x", "y")
+# default_geom <- function(.) GeomRect
+#
+# calculate <- function(., data, scales, binwidth = NULL, bins = c(30, 30), breaks = NULL, origin = NULL, drop = TRUE, ...) {
+#
+# bins <- bin_rect(data$x, data$y, data$weight,
+# xbreaks = interval_breaks(bins[1], binwidth[1],
+# range = scales$x$output_set()),
+# ybreaks = interval_breaks(bins[2], binwidth[2],
+# range = scales$y$output_set()),
+# )
+#
+# if (drop) bins <- bins[bins$count > 0, ]
+# bins$density <- bin$count / sum(bin$count, na.rm = TRUE)
+# bins
+# }
+# })
View
14 R/stat-density.r
@@ -12,12 +12,14 @@
#' @S3method stat_transform density
#' @S3method aes_required density
#' @S3method aes_present density
-#' @result \item{density}{density estimate}
-#' @result \item{count}{density * number of points, an approximate count, and
-#' useful for stacked density plots}
-#' @result \item{scaled}{density estimate, scaled to maximum of 1}
-#' @seealso \code{\link{stat_bin}} for the histogram
-#' @seealso \code{\link{density}} for details of the algorithm used
+#' @return \itemize{
+#' \item{density}{density estimate}
+#' \item{count}{density * number of points, an approximate count, and
+#' useful for stacked density plots}
+#' \item{scaled}{density estimate, scaled to maximum of 1}
+#' }
+#' @seealso \code{\link{stat_bin}} for the histogram,
+#' \code{\link{density}} for details of the algorithm used
stat_density <- function(adjust = 1, kernel = "gaussian", bw = "nrd0", n = 512) {
stat_from_call("density")
}
View
15 man/add_group.Rd
@@ -0,0 +1,15 @@
+\name{add_group}
+\alias{add_group}
+\title{Ensure that the data frame contains a grouping variable.}
+\usage{
+ add_group(data)
+}
+\value{
+ a data.frame with group variable
+}
+\description{
+ If the \code{group} variable is not present, then a new
+ group variable is generated from the interaction of all
+ discrete (factor or character) vectors excluding label.
+}
+
View
12 man/adjust_fill.Rd
@@ -0,0 +1,12 @@
+\name{adjust_fill}
+\alias{adjust_fill}
+\title{Stack overlapping objects on top of one another, and standardise
+to have equal height.}
+\usage{
+ adjust_fill(width = NULL)
+}
+\description{
+ Stack overlapping objects on top of one another, and
+ standardise to have equal height.
+}
+
View
10 man/adjust_stack.Rd
@@ -0,0 +1,10 @@
+\name{adjust_stack}
+\alias{adjust_stack}
+\title{Stack overlapping objects on top of one another}
+\usage{
+ adjust_stack(width)
+}
+\description{
+ Stack overlapping objects on top of one another
+}
+
View
10 man/aes_all.Rd
@@ -0,0 +1,10 @@
+\name{aes_all}
+\alias{aes_all}
+\title{All aesthetics}
+\usage{
+ aes_all(geom)
+}
+\description{
+ All aesthetics
+}
+
View
16 man/aes_default.Rd
@@ -0,0 +1,16 @@
+\name{aes_default}
+\alias{aes_default}
+\title{Default aesthetics.}
+\usage{
+ aes_default(geom)
+}
+\value{
+ named list of default values
+}
+\description{
+ These values are used to fill in missing aesthetics to
+ provide default values. See \code{\link{build_defaults}}
+ for a way to build defaults from a common list of
+ options.
+}
+
View
13 man/aes_icon.Rd
@@ -0,0 +1,13 @@
+\name{aes_icon}
+\alias{aes_icon}
+\title{Default aesthetics for drawing representation icons.}
+\usage{
+ aes_icon(geom)
+}
+\value{
+ list of aesthetics
+}
+\description{
+ Default aesthetics for drawing representation icons.
+}
+
View
15 man/aes_present.Rd
@@ -0,0 +1,15 @@
+\name{aes_present}
+\alias{aes_present}
+\title{Aesthetics that should be non-missing.}
+\usage{
+ aes_present(geom)
+}
+\value{
+ character vector of aesthetic names
+}
+\description{
+ Present aesthetics must be non-missing - rows of data
+ that have missing values for these aesthetics are removed
+ with a warning.
+}
+
View
15 man/aes_required.Rd
@@ -0,0 +1,15 @@
+\name{aes_required}
+\alias{aes_required}
+\title{Required aesthetics.}
+\usage{
+ aes_required(geom)
+}
+\value{
+ character vector of aesthetic names
+}
+\description{
+ Required aesthetics must be present, otherwise the geom
+ can not be drawn. These are usually position aesthetics,
+ as all others are supplied by the defaults.
+}
+
View
10 man/build_defaults.Rd
@@ -0,0 +1,10 @@
+\name{build_defaults}
+\alias{build_defaults}
+\title{Build set of defaults from named types.}
+\usage{
+ build_defaults(types)
+}
+\description{
+ Build set of defaults from named types.
+}
+
View
21 man/calc_aesthetics.Rd
@@ -0,0 +1,21 @@
+\name{calc_aesthetics}
+\alias{calc_aesthetics}
+\title{Update data with aesthetic defaults and parameters values.}
+\usage{
+ calc_aesthetics(geom, data)
+}
+\value{
+ a list
+}
+\description{
+ This function is called by individual grob functions to
+ combine data, defaults and aesthetic parameters. It also
+ checks that all necessary aesthetics are present.
+}
+\details{
+ A list is returned so that constant aesthetics don't need
+ to be needlessly repeated - the recycling can occur
+ internally in grid. \code{geom_grob} methods should try
+ and maintain this structure where possible.
+}
+
View
11 man/check_aesthetic_params.Rd
@@ -0,0 +1,11 @@
+\name{check_aesthetic_params}
+\alias{check_aesthetic_params}
+\title{Check that aesthetic parameters are for correct aesthetics.}
+\usage{
+ check_aesthetic_params(geom, aesthetics)
+}
+\description{
+ Check that aesthetic parameters are for correct
+ aesthetics.
+}
+
View
11 man/check_missing_aesthetics.Rd
@@ -0,0 +1,11 @@
+\name{check_missing_aesthetics}
+\alias{check_missing_aesthetics}
+\title{Should be called once for each layer, not once for each panel.}
+\usage{
+ check_missing_aesthetics(geom, data)
+}
+\description{
+ Should be called once for each layer, not once for each
+ panel.
+}
+
View
10 man/check_required_aesthetics.Rd
@@ -0,0 +1,10 @@
+\name{check_required_aesthetics}
+\alias{check_required_aesthetics}
+\title{Check that all required aesthetics are present.}
+\usage{
+ check_required_aesthetics(geom, data)
+}
+\description{
+ Check that all required aesthetics are present.
+}
+
View
29 man/geom_bar.Rd
@@ -0,0 +1,29 @@
+\docType{data}
+\name{geom_bar}
+\alias{geom_bar}
+\title{Bars, rectangles with bases on x-axis.}
+\format{NULL}
+\usage{
+ geom_bar
+}
+\description{
+ Bars, rectangles with bases on x-axis.
+}
+\examples{
+df <- data.frame(x = seq(0,1, 0.1), y = seq(0, 1, 0.1))
+geom_plot(geom_bar(), df)
+geom_plot(geom_bar(), df, munch = TRUE)
+geom_plot(geom_bar(width = 0.1), df)
+geom_plot(geom_bar(width = 0.05), df)
+geom_plot(geom_bar(list(colour = "red")), df)
+}
+\seealso{
+ \code{\link{stat_bin}: for more details of the binning
+ algorithm #'
+
+ \code{\link{position_dodge}}: for side-by-side barcharts
+
+ \code{\link{position_stack}}: for more info on stacking
+}
+\keyword{datasets}
+
View
25 man/geom_data.Rd
@@ -0,0 +1,25 @@
+\name{geom_data}
+\alias{geom_data}
+\title{Process data for the geom.}
+\usage{
+ geom_data(geom, data)
+}
+\value{
+ a list, suitable for operation with
+ \code{\link{geom_data}}
+}
+\description{
+ This method is run just prior to creating the grob, and
+ is used to get the data into a format which requires
+ minimal processing to be supplied to a geom. This is
+ separated out into a separate method because a number of
+ grobs process data in a slightly different way but
+ otherwise inherit all other behaviours, and to make
+ testing easier.
+}
+\details{
+ The default behaviour uses \code{\link{calc_aesthetics}}
+ to update the data with the aesthetic parameters and
+ defaults stored in the geom.
+}
+
View
12 man/geom_deparse.Rd
@@ -0,0 +1,12 @@
+\name{geom_deparse}
+\alias{geom_deparse}
+\title{Deparse a geom into the call that created it.
+Useful for serialising ggplot2 objects back into R code.}
+\usage{
+ geom_deparse(geom)
+}
+\description{
+ Deparse a geom into the call that created it. Useful for
+ serialising ggplot2 objects back into R code.
+}
+
View
21 man/geom_grob.Rd
@@ -0,0 +1,21 @@
+\name{geom_grob}
+\alias{geom_grob}
+\title{Render a grid grob from a geom and a dataset.}
+\usage{
+ geom_grob(geom, data, ...)
+}
+\value{
+ a grob
+}
+\description{
+ This is the key method to implement when creating a new
+ geom. Given a geom and its paramters, and a dataset, it
+ renders the data to produce a grid grob. The data
+ supplied to this function has already been scaled, so all
+ values are interpretable by grid, but it has not been
+ fleshed out with geom defaults and aesthetics parameters
+ - use \code{\link{calc_aesthetics}} to do so. (This is
+ done at the last minute to avoid passing around large
+ chunks of duplicated data)
+}
+
View
25 man/geom_line.Rd
@@ -0,0 +1,25 @@
+\name{geom_line}
+\alias{geom_line}
+\title{Connect observations, in ordered by x value}
+\usage{
+ geom_line(aesthetics = list(), arrow = NULL,
+ lineend = "butt", linejoin = "round", linemitre = 1,
+ na.rm = FALSE, ...)
+}
+\description{
+ Connect observations, in ordered by x value
+}
+\examples{
+df <- data.frame(x = sample(1:10), y = sample(1:10))
+geom_plot(geom_line(), df)
+geom_plot(geom_line(list(colour = "red")), df)
+geom_plot(geom_line(list(size = 3)), df)
+}
+\seealso{
+ \code{link{geom_path}}: free path, not ordered by x
+
+ \code{link{geom_segment}}: line segments
+
+ \code{link{geom_ribbon}}: fill between line and x-axis
+}
+
View
26 man/geom_munch.Rd
@@ -0,0 +1,26 @@
+\name{geom_munch}
+\alias{geom_munch}
+\title{Prepare the data for munching (if needed).}
+\usage{
+ geom_munch(geom, data)
+}
+\value{
+ list containing \itemize{ \item{data}{the munched data}
+ \item{geom}{the new geom} }
+}
+\description{
+ This function will only be run if the coordinate system
+ is non-linear, and requires "munching" (breaking the data
+ into small enough pieces that they will still be linear
+ after transformation).
+}
+\details{
+ This usually requires reparameterising the geom to by
+ something that can be drawn by \code{\link{geom_path}} or
+ \code{\link{geom_polygon}}, and so the function should
+ return both the data and the new geom to be used to draw
+ the data.
+
+ The default method leaves the data and geom unchanged.
+}
+
View
10 man/geom_munch.rect.Rd
@@ -0,0 +1,10 @@
+\name{geom_munch.rect}
+\alias{geom_munch.rect}
+\title{Convert rectangles into polygons with four corners}
+\usage{
+ geom_munch.rect(geom, data)
+}
+\description{
+ Convert rectangles into polygons with four corners
+}
+
View
10 man/geom_name.Rd
@@ -0,0 +1,10 @@
+\name{geom_name}
+\alias{geom_name}
+\title{The name of the geom.}
+\usage{
+ geom_name(geom)
+}
+\description{
+ The name of the geom.
+}
+
View
38 man/geom_path.Rd
@@ -0,0 +1,38 @@
+\name{geom_path}
+\alias{geom_path}
+\title{Connect observations, in original order.}
+\usage{
+ geom_path(aesthetics = list(), arrow = NULL,
+ lineend = "butt", linejoin = "round", linemitre = 1,
+ na.rm = FALSE, ...)
+}
+\arguments{
+ \item{lineend}{Line end style (round, butt, square)}
+
+ \item{linejoin}{Line join style (round, mitre, bevel)}
+
+ \item{linemitre}{Line mitre limit (number greater than
+ 1)}
+
+ \item{arrow}{Arrow specification, as created by ?arrow}
+}
+\description{
+ Lines containing less than two observations will be
+ silently dropped.
+}
+\examples{
+df <- data.frame(x = sample(1:10), y = sample(1:10))
+geom_plot(geom_path(), df)
+geom_plot(geom_path(list(colour = "red")), df)
+geom_plot(geom_path(list(size = 3)), df)
+
+geom_plot(geom_path(list(x = 1:10, y = 10:1)))
+}
+\seealso{
+ \code{\link{geom_line}}: functional (ordered) lines
+
+ \code{\link{geom_polygon}}: filled paths (polygons)
+
+ \code{\link{geom_segment}}: line segments
+}
+
View
13 man/geom_plot.Rd
@@ -0,0 +1,13 @@
+\name{geom_plot}
+\alias{geom_plot}
+\title{Convenience method for plotting geoms.}
+\usage{
+ geom_plot(geom, data = list(), munch = FALSE)
+}
+\description{
+ This illustrates the basic pipeline by which the geom
+ methods are called, and makes it easier to visually test
+ geoms, but graphics packages will usually call the
+ methods individually themselves.
+}
+
View
18 man/geom_point.Rd
@@ -0,0 +1,18 @@
+\name{geom_point}
+\alias{geom_point}
+\usage{
+ geom_point(aesthetics = list(), na.rm = FALSE, ...)
+}
+\arguments{
+ \item{na.rm}{If \code{TRUE} silently remove missing
+ values, otherwise warn that they are being removed.}
+}
+\examples{
+df <- data.frame(x = seq(0,1, 0.1), y = seq(0, 1, 0.1))
+geom_plot(geom_point(), df)
+geom_plot(geom_point(list(colour = "red")), df)
+geom_plot(geom_point(list(size = 3, shape = 15)), df)
+
+geom_plot(geom_point(list(x = 1:10, y = 10:1)))
+}
+
View
27 man/geom_polygon.Rd
@@ -0,0 +1,27 @@
+\name{geom_polygon}
+\alias{geom_polygon}
+\title{Polygon, a filled path.}
+\usage{
+ geom_polygon(aesthetics = list())
+}
+\description{
+ Polygon, a filled path.
+}
+\examples{
+if (require(maps)) {
+ ni <- data.frame(map("nz", "North.Island", plot = F)[c("x", "y")])
+ si <- data.frame(map("nz", "South.Island", plot = F)[c("x", "y")])
+ geom_plot(geom_polygon(), ni)
+ geom_plot(geom_polygon(list(colour = "grey50", fill = NA)), si)
+
+ nz <- rbind(data.frame(ni, group = 1), data.frame(si, group = 2))
+ geom_plot(geom_polygon(), nz)
+}
+}
+\seealso{
+ \code{\link{geom_path}}: an unfilled polygon
+
+ \code{\link{geom_ribbon}}: a polygon anchored on the
+ x-axis
+}
+
View
10 man/geom_rect.Rd
@@ -0,0 +1,10 @@
+\name{geom_rect}
+\alias{geom_rect}
+\title{2d rectangles.}
+\usage{
+ geom_rect(aesthetics = list(), na.rm = FALSE, ...)
+}
+\description{
+ 2d rectangles.
+}
+
View
24 man/geom_ribbon.Rd
@@ -0,0 +1,24 @@
+\name{geom_ribbon}
+\alias{geom_ribbon}
+\title{Ribbons, y range with continuous x values}
+\usage{
+ geom_ribbon(aesthetics = list(), ...)
+}
+\description{
+ Ribbons, y range with continuous x values
+}
+\examples{
+height <- runif(10)
+df <- data.frame(x = 1:10, ymax = 5 + height, ymin = 5 - height)
+geom_plot(geom_ribbon(), df)
+geom_plot(geom_ribbon(list(colour = "red")), df)
+geom_plot(geom_ribbon(list(colour = "red", fill = NA)), df)
+}
+\seealso{
+ \code{\link{geom_bar}}: discrete intervals (bars)
+
+ \code{\link{geom_linerange}}: discrete intervals (lines)
+
+ \code{\link{geom_polygon}}: general polygons
+}
+
View
13 man/geom_rug.Rd
@@ -0,0 +1,13 @@
+\name{geom_rug}
+\alias{geom_rug}
+\title{Marginal rug plots}
+\usage{
+ geom_rug(aesthetics = list(), length = unit(0.03, "npc"))
+}
+\arguments{
+ \item{length}{length of rug tassles, as a grid unit}
+}
+\description{
+ Marginal rug plots
+}
+
View
28 man/geom_segment.Rd
@@ -0,0 +1,28 @@
+\name{geom_segment}
+\alias{geom_segment}
+\title{Single line segments.}
+\usage{
+ geom_segment(aesthetics = list(), arrow = NULL)
+}
+\arguments{
+ \item{arrow}{specification for arrow heads, as created by
+ arrow()}
+}
+\description{
+ Single line segments.
+}
+\examples{
+df <- data.frame(x = runif(20), y = runif(20))
+df <- transform(df,
+ xend = x + rnorm(20, sd = 1/5),
+ yend = y + rnorm(20, sd = 1/5))
+geom_plot(geom_segment(), df)
+geom_plot(geom_segment(), df, munch = TRUE)
+geom_plot(geom_segment(arrow = arrow()), df)
+}
+\seealso{
+ \code{\link{geom_path}} connect multiple points
+
+ \code{\link{geom_line}} connect points ordered along x.
+}
+
View
18 man/geom_stat.Rd
@@ -0,0 +1,18 @@
+\name{geom_stat}
+\alias{geom_adjust}
+\alias{geom_stat}
+\title{Default related stat and adjust.}
+\usage{
+ geom_stat(geom, ...)
+}
+\arguments{
+ \item{...}{Other arguments passed on to the object
+ creation function. These are used when initialised a
+ geom from a name and list of parameters, which may belong
+ to the stat or the position adjustment.}
+}
+\description{
+ The defaults are the identity functions which leave the
+ data unchanged.
+}
+
View
20 man/geom_step.Rd
@@ -0,0 +1,20 @@
+\name{geom_step}
+\alias{geom_step}
+\title{Connect observations with stairs.}
+\usage{
+ geom_step(aesthetics = list(), direction = "hv")
+}
+\arguments{
+ \item{direction}{= "direction of stairs: 'vh' for
+ vertical then horizontal, or 'hv' for horizontal then
+ vertical"}
+}
+\description{
+ Equivalent to plot(type='s').
+}
+\examples{
+df <- data.frame(x = 1:10, y = 1:10)
+geom_plot(geom_step(), df)
+geom_plot(geom_step(direction = "vh"), df)
+}
+
View
30 man/geom_text.Rd
@@ -0,0 +1,30 @@
+\name{geom_text}
+\alias{geom_text}
+\title{Textual annotations}
+\usage{
+ geom_text(aesthetics = list(), parse = FALSE,
+ fontfamily = NULL, fontface = NULL, lineheight = NULL)
+}
+\arguments{
+ \item{parse}{If \code{TRUE}, the labels will be parsed
+ into expressions and displayed as described in
+ \code{\link{plotmath}}}
+
+ \item{fontfamily}{}
+
+ \item{fontface}{character string specifying plain, bold,
+ italic etc.}
+
+ \item{lineheight}{line height as multiple of text height}
+}
+\description{
+ Textual annotations
+}
+\examples{
+df <- data.frame(x = 1:5, y = 1:5, label = letters[1:5])
+geom_plot(geom_text(), df)
+geom_plot(geom_text(list(angle = 45)), df)
+geom_plot(geom_text(fontface = "bold"), df)
+geom_plot(geom_text(fontfamily = "Times New Roman"), df)
+}
+
View
10 man/geom_visualise.Rd
@@ -0,0 +1,10 @@
+\name{geom_visualise}
+\alias{geom_visualise}
+\title{An iconic version of the geom.}
+\usage{
+ geom_visualise(geom, data = list())
+}
+\description{
+ Suitable for use in GUIs, documentation etc.
+}
+
View
9 man/layers.Rd
@@ -0,0 +1,9 @@
+\docType{package}
+\name{layers}
+\alias{layers}
+\alias{layers-package}
+\title{The layers package.}
+\description{
+ The layers package.
+}
+
View
23 man/parse_dots.Rd
@@ -0,0 +1,23 @@
+\name{parse_dots}
+\alias{parse_dots}
+\title{Creates layer function given a geom and stat.}
+\usage{
+ parse_dots(dots, geom = NULL, stat = NULL, adjust = NULL)
+}
+\value{
+ a list of (up to) three components \item{geom}{parameters
+ that belong to the geom} \item{stat}{parameters that
+ belong to the stat} \item{adjust}{parameters that belong
+ to the adjust}
+}
+\description{
+ The new function includes the arguments for geom, as well
+ as mapping, data and \code{...}. The \code{...}
+ arguments must be named, and the name are used to
+ determine which component (stat, adjustment or geom
+ aesthetics) that parameter corresponds to.
+}
+\details{
+ Parse named list of arguments into components.
+}
+
View
33 man/stat_contour.Rd
@@ -0,0 +1,33 @@
+\name{stat_contour}
+\alias{stat_contour}
+\title{Computer contours (iso-levels) of 3d data.}
+\usage{
+ stat_contour(bins = NULL, binwidth = NULL, breaks = NULL,
+ na.rm = FALSE)
+}
+\arguments{
+ \item{bins}{number of contours (specify one of bins,
+ binwidth, breaks)}
+
+ \item{binwidth}{distance between each contour (specify
+ one of bins, binwidth, breaks)}
+
+ \item{breaks}{exact locations of contours (specify one of
+ bins, binwidth, breaks)}
+}
+\value{
+ \item{level} height of contour
+}
+\description{
+ Computer contours (iso-levels) of 3d data.
+}
+\examples{
+if (require("reshape2")) {
+ volcano3d <- melt(volcano)
+ names(volcano3d) <- c("x", "y", "z")
+ volcano3d <- add_group(volcano3d)
+ contours <- stat_transform(stat_contour(), volcano3d)
+ geom_plot(geom_path(), contours)
+}
+}
+
View
34 man/stat_density.Rd
@@ -0,0 +1,34 @@
+\name{stat_density}
+\alias{stat_density}
+\title{1d density estimation.}
+\usage{
+ stat_density(adjust = 1, kernel = "gaussian",
+ bw = "nrd0", n = 512)
+}
+\arguments{
+ \item{adjust}{see ?density for details}
+
+ \item{kernel}{string giving kernel used for density
+ estimation, see \\code{\\link{density}} for details"}
+
+ \item{bw}{the smoothing bandwidth to be used, or a
+ character vector giving the name of an algorithm to
+ calculate it automatically}
+
+ \item{n}{number of points in output}
+}
+\value{
+ \itemize{ \item{density}{density estimate}
+ \item{count}{density * number of points, an approximate
+ count, and useful for stacked density plots}
+ \item{scaled}{density estimate, scaled to maximum of 1} }
+}
+\description{
+ Groups containing three observations or less are silently
+ dropped.
+}
+\seealso{
+ \code{\link{stat_bin}} for the histogram,
+ \code{\link{density}} for details of the algorithm used
+}
+
View
26 man/stat_density2d.Rd
@@ -0,0 +1,26 @@
+\name{stat_density2d}
+\alias{stat_density2d}
+\title{2d density estimate}
+\usage{
+ stat_density2d(contour = TRUE, n = 100, kde2d = list())
+}
+\arguments{
+ \item{contour}{If TRUE, contour the results of the 2d
+ density estimation}
+
+ \item{n}{number of grid points in each direction}
+
+ \item{kde2d}{other arguments passed on to
+ \code{\link{kde2d}}}
+}
+\value{
+ \item{level}{Value of density contour, if contour =
+ \code{TRUE}}
+
+ \item{density}{Value of density at location, if contour =
+ \code{FALSE}}
+}
+\description{
+ 2d density estimate
+}
+
View
18 man/stat_densitypoint.Rd
@@ -0,0 +1,18 @@
+\name{stat_densitypoint}
+\alias{stat_densitypoint}
+\title{Compute the density at each point in the data}
+\usage{
+ stat_densitypoint(scale = TRUE)
+}
+\arguments{
+ \item{scale}{should x and y positions be scaled
+ independently?}
+}
+\description{
+ Requires the locfit package.
+}
+\seealso{
+ \code{\link{locfit}} for the algorithm used to calculate
+ the density
+}
+
View
10 man/stat_identity.Rd
@@ -0,0 +1,10 @@
+\name{stat_identity}
+\alias{stat_identity}
+\title{Identity transformation}
+\usage{
+ stat_identity()
+}
+\description{
+ Identity transformation
+}
+
View
24 man/stat_sum.Rd
@@ -0,0 +1,24 @@
+\name{stat_sum}
+\alias{stat_sum}
+\title{Sum unique values. Useful for overplotting on scatterplots.}
+\usage{
+ stat_sum(...)
+}
+\value{
+ \item{n} number of observations at position
+
+ \item{prop} percent of points in that panel at that
+ position
+}
+\description{
+ Sum unique values. Useful for overplotting on
+ scatterplots.
+}
+\examples{
+df <- data.frame(x = rpois(1e3, 3), y = rpois(1e3, 4))
+locs <- stat_transform(stat_sum(), add_group(df))
+names(locs)[5] <- "size"
+locs$size <- sqrt(locs$size / 5)
+geom_plot(geom_point(), locs)
+}
+
View
15 man/stat_transform.densitypoint.Rd
@@ -0,0 +1,15 @@
+\name{stat_transform.densitypoint}
+\alias{stat_transform.densitypoint}
+\title{data(diamonds, package = "ggplot2")
+df <- diamonds[c("price", "carat")]
+names(df) <- c("x", "y")
+stat_transform(stat_densitypoint(), df)}
+\usage{
+ stat_transform.densitypoint(stat, data, xrange, yrange)
+}
+\description{
+ data(diamonds, package = "ggplot2") df <-
+ diamonds[c("price", "carat")] names(df) <- c("x", "y")
+ stat_transform(stat_densitypoint(), df)
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.