1# Environment that holds various global variables and settings for ggplot,
2# such as the current theme. It is not exported and should not be directly
3# manipulated by other packages.
4ggplot_global <- new.env(parent = emptyenv())
5
6# The current theme. Defined here only as placeholder, and defined properly
7# in file "theme-current.R". This setup avoids circular dependencies among
8# the various source files.
9ggplot_global$theme_current <- list()
10
11# Element tree for the theme elements. Defined here only as placeholder, and
12# defined properly in file "theme-elements.r".
13ggplot_global$element_tree <- list()
14
15# List of all aesthetics known to ggplot
16# (In the future, .all_aesthetics should be removed in favor
17# of direct assignment to ggplot_global$all_aesthetics, see below.)
18.all_aesthetics <- c(
19  "adj", "alpha", "angle", "bg", "cex", "col", "color",
20  "colour", "fg", "fill", "group", "hjust", "label", "linetype", "lower",
21  "lty", "lwd", "max", "middle", "min", "pch", "radius", "sample", "shape",
22  "size", "srt", "upper", "vjust", "weight", "width", "x", "xend", "xmax",
23  "xmin", "xintercept", "y", "yend", "ymax", "ymin", "yintercept", "z"
24)
25
26ggplot_global$all_aesthetics <- .all_aesthetics
27
28# Aesthetic aliases
29# (In the future, .base_to_ggplot should be removed in favor
30# of direct assignment to ggplot_global$base_to_ggplot, see below.)
31.base_to_ggplot <- c(
32  "col"   = "colour",
33  "color" = "colour",
34  "pch"   = "shape",
35  "cex"   = "size",
36  "lty"   = "linetype",
37  "lwd"   = "size",
38  "srt"   = "angle",
39  "adj"   = "hjust",
40  "bg"    = "fill",
41  "fg"    = "colour",
42  "min"   = "ymin",
43  "max"   = "ymax"
44)
45
46ggplot_global$base_to_ggplot <- .base_to_ggplot
47
48# These two vectors must match in length and position of symmetrical aesthetics
49# xintercept2 is a filler to match to the intercept aesthetic in geom_abline
50ggplot_global$x_aes <- c("x", "xmin", "xmax", "xend", "xintercept",
51  "xmin_final", "xmax_final", "xlower", "xmiddle", "xupper", "x0")
52
53ggplot_global$y_aes <- c("y", "ymin", "ymax", "yend", "yintercept",
54  "ymin_final", "ymax_final", "lower", "middle", "upper", "y0")
55