Permalink
Browse files

Change to aesthetic prefix; split into more topics

For documentation, change the aes prefix to aesthetic to
differentiate between the aes functions and the descriptions
of aesthetics. This results in renamed man files.

alpha split from colour and fill; linetype, shape, and size
split apart.

Standardized titles

Gave them all @family aesthetics to make automatic
cross-referencing.

Fixed cross-references in aes function documentation.
  • Loading branch information...
1 parent 57ada20 commit b12fd9a30400a1cc4998b148d93b8f22a6602942 @BrianDiggs committed Dec 14, 2012
View
@@ -34,8 +34,13 @@
#' @param ... List of name value pairs giving aesthetics to map.
#' @seealso \code{\link{aes_string}} for passing quoted variable names.
#" Useful when creating plots within user defined functions. Also,
-#' \code{\link{aes_colour_fill_alpha}}, \code{\link{aes_group_order}},
-#' \code{\link{aes_linetype_size_shape}} and \code{\link{aes_position}}
+#' \code{\link{aesthetic_colour_fill}},
+#' \code{\link{aesthetic_alpha}},
+#' \code{\link{aesthetic_group_order}},
+#' \code{\link{aesthetic_linetype}},
+#' \code{\link{aesthetic_size}},
+#' \code{\link{aesthetic_shape}} and
+#' \code{\link{aesthetic_position}}
#' for more specific examples with different aesthetics.
#' @S3method str uneval
#' @S3method print uneval
View
@@ -1,11 +1,12 @@
-#' Colour related aesthetics: colour, fill and alpha
+#' Aesthetics related to colour: colour, fill
#'
#' This page demonstrates the usage of a sub-group
-#' of aesthetics; colour, fill and alpha.
+#' of aesthetics; colour and fill.
#'
-#' @rdname aes_colour_fill_alpha
-#' @name aes_colour_fill_alpha
-#' @aliases colour color fill alpha
+#' @rdname aesthetic_colour_fill
+#' @name aesthetic_colour_fill
+#' @aliases colour color fill aesthetic-colour aesthetic-fill
+#' @family aesthetics
#' @examples
#' \donttest{
#'
@@ -36,6 +37,19 @@
#' b + geom_line(colour = "green")
#' b + geom_point()
#' b + geom_point(colour = "red")
+#' }
+NULL
+
+#' Aesthetic: alpha
+#'
+#' This page demonstrates the usage of the aesthetic alpha.
+#'
+#' @rdname aesthetic_alpha
+#' @name aesthetic_alpha
+#' @aliases alpha aesthetic-alpha
+#' @family aesthetics
+#' @examples
+#' \donttest{
#'
#' # For large datasets with overplotting the alpha
#' # aesthetic will make the points more transparent
@@ -61,12 +75,12 @@
#' }
NULL
-#' Aesthetics: group, order
+#' Aesthetics related to grouping: group, order
#'
-#' @rdname aes_group_order
-#' @name aes_group_order
-#' @aliases group order
-#'
+#' @rdname aesthetic_group_order
+#' @name aesthetic_group_order
+#' @aliases group order aesthetic-group aesthetic-order
+#' @family aesthetics
#' @examples
#' \donttest{
#'
@@ -156,14 +170,14 @@ NULL
#' }
NULL
-#' Differentiation related aesthetics: linetype, size, shape
+#' Aesthetic: linetype
#'
-#' This page demonstrates the usage of a sub-group
-#' of aesthetics; linetype, size and shape.
+#' This page demonstrates the usage of the linetype aesthetic.
#'
-#' @rdname aes_linetype_size_shape
-#' @name aes_linetype_size_shape
-#' @aliases linetype size shape
+#' @rdname aesthetic_linetype
+#' @name aesthetic_linetype
+#' @aliases linetype aesthetic-linetype
+#' @family aesthetics
#' @examples
#'
#' # Line types should be specified with either an integer, a name, or with a string of
@@ -191,6 +205,17 @@ NULL
#' colwise(rescale01)(economics[, -(1:2)]))
#' ecm <- melt(ec_scaled, id = "date")
#' qplot(date, value, data = ecm, geom = "line", linetype = variable)
+NULL
+
+#' Aesthetic: size
+#'
+#' This page demonstrates the usage of the size aesthetic.
+#'
+#' @rdname aesthetic_size
+#' @name aesthetic_size
+#' @aliases size aesthetic-size
+#' @family aesthetics
+#' @examples
#'
#' # Size examples
#' # Should be specified with a numerical value (in millimetres),
@@ -199,12 +224,24 @@ NULL
#' p + geom_point(size = 4)
#' p + geom_point(aes(size = qsec))
#' p + geom_point(size = 2.5) + geom_hline(yintercept = 25, size = 3.5)
+NULL
+
+#' Aesthetic: shape
+#'
+#' This page demonstrates the usage of the shape aesthetic.
+#'
+#' @rdname aesthetic_shape
+#' @name aesthetic_shape
+#' @aliases shape aesthetic-shape
+#' @family aesthetics
+#' @examples
#'
#' # Shape examples
#' # Shape takes four types of values: an integer in [0, 25],
#' # a single character-- which uses that character as the plotting symbol,
#' # a . to draw the smallest rectangle that is visible (i.e., about one pixel)
#' # an NA to draw nothing
+#' p <- ggplot(mtcars, aes(wt, mpg))
#' p + geom_point()
#' p + geom_point(shape = 5)
#' p + geom_point(shape = "k", size = 3)
@@ -226,14 +263,14 @@ NULL
#' scale_shape_identity()
NULL
-#' Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
+#' Aesthetics related to position: x, y, xmin, xmax, ymin, ymax, xend, yend
#'
#' This page demonstrates the usage of a sub-group
#' of aesthetics; x, y, xmin, xmax, ymin, ymax, xend, and yend.
#'
-#' @rdname aes_position
-#' @name aes_position
-#' @aliases x y xmin xmax ymin ymax xend yend
+#' @rdname aesthetic_position
+#' @name aesthetic_position
+#' @aliases x y xmin xmax ymin ymax xend yend aesthetic-x aesthetic-y aesthetic-xmin aesthetic-xmax aesthetic-ymin aesthetic-ymax aesthetic-xend aesthetic-yend
#' @examples
#'
#' # Generate data: means and standard errors of means for prices
View
@@ -25,10 +25,13 @@ aes(x = mpg ^ 2, y = wt / cyl)
}
\seealso{
\code{\link{aes_string}} for passing quoted variable
- names. \code{\link{aes_colour_fill_alpha}},
- \code{\link{aes_group_order}},
- \code{\link{aes_linetype_size_shape}} and
- \code{\link{aes_position}} for more specific examples
- with different aesthetics.
+ names. \code{\link{aesthetic_colour_fill}},
+ \code{\link{aesthetic_alpha}},
+ \code{\link{aesthetic_group_order}},
+ \code{\link{aesthetic_linetype}},
+ \code{\link{aesthetic_size}},
+ \code{\link{aesthetic_shape}} and
+ \code{\link{aesthetic_position}} for more specific
+ examples with different aesthetics.
}
@@ -1,70 +0,0 @@
-\name{aes_linetype_size_shape}
-\alias{aes_linetype_size_shape}
-\alias{linetype}
-\alias{shape}
-\alias{size}
-\title{Differentiation related aesthetics: linetype, size, shape}
-\description{
- This page demonstrates the usage of a sub-group of
- aesthetics; linetype, size and shape.
-}
-\examples{
-# Line types should be specified with either an integer, a name, or with a string of
-# an even number (up to eight) of hexidecimal digits which give the lengths in
-# consecutive positions in the string.
-# 0 = blank, 1 = solid, 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash, 6 = twodash
-
-# Data
-df <- data.frame(x = 1:10 , y = 1:10)
-f <- ggplot(df, aes(x = x, y = y))
-f + geom_line(linetype = 2)
-f + geom_line(linetype = "dotdash")
-# An example with hex strings, the string "33" specifies three units on followed
-# by three off and "3313" specifies three units on followed by three off followed
-# by one on and finally three off.
-f + geom_line(linetype = "3313")
-
-# Mapping line type from a variable
-library(plyr)
-library(reshape2)
-rescale01 <- function(x) (x - min(x)) / diff(range(x))
-ec_scaled <- data.frame(
- date = economics$date,
- colwise(rescale01)(economics[, -(1:2)]))
-ecm <- melt(ec_scaled, id = "date")
-qplot(date, value, data = ecm, geom = "line", linetype = variable)
-
-# Size examples
-# Should be specified with a numerical value (in millimetres),
-# or from a variable source
-p <- ggplot(mtcars, aes(wt, mpg))
-p + geom_point(size = 4)
-p + geom_point(aes(size = qsec))
-p + geom_point(size = 2.5) + geom_hline(yintercept = 25, size = 3.5)
-
-# Shape examples
-# Shape takes four types of values: an integer in [0, 25],
-# a single character-- which uses that character as the plotting symbol,
-# a . to draw the smallest rectangle that is visible (i.e., about one pixel)
-# an NA to draw nothing
-p + geom_point()
-p + geom_point(shape = 5)
-p + geom_point(shape = "k", size = 3)
-p + geom_point(shape = ".")
-p + geom_point(shape = NA)
-
-# Shape can also be mapped from a variable
-p + geom_point(aes(shape = factor(cyl)))
-
-# A look at all 25 symbols
-df2 <- data.frame(x = 1:5 , y = 1:25, z = 1:25)
-s <- ggplot(df2, aes(x = x, y = y))
-s + geom_point(aes(shape = z), size = 4) + scale_shape_identity()
-# While all symbols have a foreground colour, symbols 19-25 also take a
-# background colour (fill)
-s + geom_point(aes(shape = z), size = 4, colour = "Red") +
- scale_shape_identity()
-s + geom_point(aes(shape = z), size = 4, colour = "Red", fill = "Black") +
- scale_shape_identity()
-}
-
View
@@ -0,0 +1,42 @@
+\name{aesthetic_alpha}
+\alias{aesthetic-alpha}
+\alias{aesthetic_alpha}
+\alias{alpha}
+\title{Aesthetic: alpha}
+\description{
+ This page demonstrates the usage of the aesthetic alpha.
+}
+\examples{
+\donttest{
+
+# For large datasets with overplotting the alpha
+# aesthetic will make the points more transparent
+df <- data.frame(x = rnorm(5000), y = rnorm(5000))
+h <- ggplot(df, aes(x,y))
+h + geom_point()
+h + geom_point(alpha = 0.5)
+h + geom_point(alpha = 1/10)
+
+#If a geom uses both fill and colour, alpha will only modify the fill colour
+c + geom_bar(fill = "dark grey", colour = "black")
+c + geom_bar(fill = "dark grey", colour = "black", alpha = 1/3)
+
+# Alpha can also be used to add shading
+j <- b + geom_line()
+j
+yrng <- range(economics$unemploy)
+j <- j + geom_rect(aes(NULL, NULL, xmin = start, xmax = end, fill = party),
+ymin = yrng[1], ymax = yrng[2], data = presidential)
+j
+library(scales) # to access the alpha function
+j + scale_fill_manual(values = alpha(c("blue", "red"), .3))
+}
+}
+\seealso{
+ Other aesthetics: \code{\link{aesthetic_colour_fill}},
+ \code{\link{aesthetic_group_order}},
+ \code{\link{aesthetic_linetype}},
+ \code{\link{aesthetic_shape}},
+ \code{\link{aesthetic_size}}
+}
+
@@ -1,13 +1,14 @@
-\name{aes_colour_fill_alpha}
-\alias{aes_colour_fill_alpha}
-\alias{alpha}
+\name{aesthetic_colour_fill}
+\alias{aesthetic-colour}
+\alias{aesthetic-fill}
+\alias{aesthetic_colour_fill}
\alias{color}
\alias{colour}
\alias{fill}
-\title{Colour related aesthetics: colour, fill and alpha}
+\title{Aesthetics related to colour: colour, fill}
\description{
This page demonstrates the usage of a sub-group of
- aesthetics; colour, fill and alpha.
+ aesthetics; colour and fill.
}
\examples{
\donttest{
@@ -39,28 +40,13 @@ b + geom_line()
b + geom_line(colour = "green")
b + geom_point()
b + geom_point(colour = "red")
-
-# For large datasets with overplotting the alpha
-# aesthetic will make the points more transparent
-df <- data.frame(x = rnorm(5000), y = rnorm(5000))
-h <- ggplot(df, aes(x,y))
-h + geom_point()
-h + geom_point(alpha = 0.5)
-h + geom_point(alpha = 1/10)
-
-#If a geom uses both fill and colour, alpha will only modify the fill colour
-c + geom_bar(fill = "dark grey", colour = "black")
-c + geom_bar(fill = "dark grey", colour = "black", alpha = 1/3)
-
-# Alpha can also be used to add shading
-j <- b + geom_line()
-j
-yrng <- range(economics$unemploy)
-j <- j + geom_rect(aes(NULL, NULL, xmin = start, xmax = end, fill = party),
-ymin = yrng[1], ymax = yrng[2], data = presidential)
-j
-library(scales) # to access the alpha function
-j + scale_fill_manual(values = alpha(c("blue", "red"), .3))
}
}
+\seealso{
+ Other aesthetics: \code{\link{aesthetic_alpha}},
+ \code{\link{aesthetic_group_order}},
+ \code{\link{aesthetic_linetype}},
+ \code{\link{aesthetic_shape}},
+ \code{\link{aesthetic_size}}
+}
@@ -1,10 +1,12 @@
-\name{aes_group_order}
-\alias{aes_group_order}
+\name{aesthetic_group_order}
+\alias{aesthetic-group}
+\alias{aesthetic-order}
+\alias{aesthetic_group_order}
\alias{group}
\alias{order}
-\title{Aesthetics: group, order}
+\title{Aesthetics related to grouping: group, order}
\description{
- Aesthetics: group, order
+ Aesthetics related to grouping: group, order
}
\examples{
\donttest{
@@ -94,4 +96,11 @@ d + geom_point()
d + geom_point(aes(order = sample(seq_along(carat))))
}
}
+\seealso{
+ Other aesthetics: \code{\link{aesthetic_alpha}},
+ \code{\link{aesthetic_colour_fill}},
+ \code{\link{aesthetic_linetype}},
+ \code{\link{aesthetic_shape}},
+ \code{\link{aesthetic_size}}
+}
Oops, something went wrong.

0 comments on commit b12fd9a

Please sign in to comment.