Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit b12fd9a30400a1cc4998b148d93b8f22a6602942 1 parent 57ada20
@BrianDiggs authored
View
9 R/aes.r
@@ -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
77 R/aesthetics.r
@@ -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
13 man/aes.Rd
@@ -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.
}
View
70 man/aes_linetype_size_shape.Rd
@@ -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
42 man/aesthetic_alpha.Rd
@@ -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}}
+}
+
View
40 man/aes_colour_fill_alpha.Rd → man/aesthetic_colour_fill.Rd
@@ -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}}
+}
View
17 man/aes_group_order.Rd → man/aesthetic_group_order.Rd
@@ -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}}
+}
View
43 man/aesthetic_linetype.Rd
@@ -0,0 +1,43 @@
+\name{aesthetic_linetype}
+\alias{aesthetic-linetype}
+\alias{aesthetic_linetype}
+\alias{linetype}
+\title{Aesthetic: linetype}
+\description{
+ This page demonstrates the usage of the linetype
+ aesthetic.
+}
+\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)
+}
+\seealso{
+ Other aesthetics: \code{\link{aesthetic_alpha}},
+ \code{\link{aesthetic_colour_fill}},
+ \code{\link{aesthetic_group_order}},
+ \code{\link{aesthetic_shape}},
+ \code{\link{aesthetic_size}}
+}
+
View
14 man/aes_position.Rd → man/aesthetic_position.Rd
@@ -1,5 +1,13 @@
-\name{aes_position}
-\alias{aes_position}
+\name{aesthetic_position}
+\alias{aesthetic-x}
+\alias{aesthetic-xend}
+\alias{aesthetic-xmax}
+\alias{aesthetic-xmin}
+\alias{aesthetic-y}
+\alias{aesthetic-yend}
+\alias{aesthetic-ymax}
+\alias{aesthetic-ymin}
+\alias{aesthetic_position}
\alias{x}
\alias{xend}
\alias{xmax}
@@ -8,7 +16,7 @@
\alias{yend}
\alias{ymax}
\alias{ymin}
-\title{Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend}
+\title{Aesthetics related to position: x, y, xmin, xmax, ymin, ymax, xend, yend}
\description{
This page demonstrates the usage of a sub-group of
aesthetics; x, y, xmin, xmax, ymin, ymax, xend, and yend.
View
43 man/aesthetic_shape.Rd
@@ -0,0 +1,43 @@
+\name{aesthetic_shape}
+\alias{aesthetic-shape}
+\alias{aesthetic_shape}
+\alias{shape}
+\title{Aesthetic: shape}
+\description{
+ This page demonstrates the usage of the shape aesthetic.
+}
+\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)
+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()
+}
+\seealso{
+ Other aesthetics: \code{\link{aesthetic_alpha}},
+ \code{\link{aesthetic_colour_fill}},
+ \code{\link{aesthetic_group_order}},
+ \code{\link{aesthetic_linetype}},
+ \code{\link{aesthetic_size}}
+}
+
View
25 man/aesthetic_size.Rd
@@ -0,0 +1,25 @@
+\name{aesthetic_size}
+\alias{aesthetic-size}
+\alias{aesthetic_size}
+\alias{size}
+\title{Aesthetic: size}
+\description{
+ This page demonstrates the usage of the size aesthetic.
+}
+\examples{
+# 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)
+}
+\seealso{
+ Other aesthetics: \code{\link{aesthetic_alpha}},
+ \code{\link{aesthetic_colour_fill}},
+ \code{\link{aesthetic_group_order}},
+ \code{\link{aesthetic_linetype}},
+ \code{\link{aesthetic_shape}}
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.