Skip to content

Commit 1814643

Browse files
author
Kirill Müller
committed
Merge remote-tracking branch 'hadley/master' into 943-single-color-continuous-scale
2 parents f628bb3 + 659d216 commit 1814643

File tree

240 files changed

+1313
-1143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+1313
-1143
lines changed

.travis.yml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
1-
# Sample .travis.yml for R projects from https://github.com/craigcitro/r-travis
1+
language: R
2+
sudo: required
3+
warnings_are_errors: true
24

3-
language: c
5+
r_github_packages:
6+
- hadley/staticdocs
7+
- jimhester/covr
48

5-
before_install:
6-
- curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh
7-
- chmod 755 ./travis-tool.sh
8-
- ./travis-tool.sh bootstrap
9-
10-
install:
11-
- ./travis-tool.sh r_binary_install colorspace strucchange deldir abind tensor polyclip minqa Rcpp RcppEigen modeltools bdsmatrix RColorBrewer dichromat munsell labeling tripack akima rgl logspline nor1mix Formula zoo dynlm chron acepack rms mice sp rgeos spatstat PBSmapping mvtnorm TH.data sandwich lme4 robustbase mboost coin car xtable lmtest coxme
12-
- ./travis-tool.sh install_deps
13-
14-
script: ./travis-tool.sh run_tests
15-
16-
on_failure:
17-
- ./travis-tool.sh dump_logs
18-
19-
notifications:
20-
email:
21-
on_success: change
22-
on_failure: change
9+
before_script:
10+
- sudo Rscript -e "library(stringi); stri_install_icudt()"
2311

12+
after_success:
13+
- Rscript -e 'covr::codecov()'
2414

2515
before_deploy:
26-
- ./travis-tool.sh install_github hadley/staticdocs
27-
- R -e "staticdocs::build_site()"
16+
- R -e "staticdocs::build_site(examples = TRUE)"
2817

2918
deploy:
3019
edge: true

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: ggplot2
22
Type: Package
33
Title: An Implementation of the Grammar of Graphics
4-
Version: 1.0.1
4+
Version: 1.0.1.9000
55
Authors@R: c(
66
person("Hadley", "Wickham", role = c("aut", "cre"), email = "[email protected]"),
77
person("Winston", "Chang", role = "aut", email = "[email protected]")
@@ -110,6 +110,7 @@ Collate:
110110
'geom-path-line.r'
111111
'geom-path-step.r'
112112
'geom-point-.r'
113+
'geom-point-count.r'
113114
'geom-point-jitter.r'
114115
'geom-pointrange.r'
115116
'geom-quantile.r'
@@ -148,12 +149,12 @@ Collate:
148149
'position-identity.r'
149150
'position-jitter.r'
150151
'position-jitterdodge.R'
152+
'position-nudge.R'
151153
'position-stack.r'
152154
'quick-plot.r'
153155
'save.r'
154156
'scale-.r'
155157
'scale-alpha.r'
156-
'scale-area.r'
157158
'scale-brewer.r'
158159
'scale-continuous.r'
159160
'scale-date.r'
@@ -196,7 +197,6 @@ Collate:
196197
'stat-vline.r'
197198
'stat-ydensity.r'
198199
'summary.r'
199-
'templates.r'
200200
'theme-defaults.r'
201201
'theme-elements.r'
202202
'theme.r'

NAMESPACE

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by roxygen2 (4.1.0): do not edit by hand
1+
# Generated by roxygen2 (4.1.1): do not edit by hand
22

33
S3method("+",gg)
44
S3method("[",uneval)
@@ -182,6 +182,7 @@ export(aes_all)
182182
export(aes_auto)
183183
export(aes_q)
184184
export(aes_string)
185+
export(alpha)
185186
export(annotate)
186187
export(annotation_custom)
187188
export(annotation_logticks)
@@ -221,6 +222,7 @@ export(geom_bin2d)
221222
export(geom_blank)
222223
export(geom_boxplot)
223224
export(geom_contour)
225+
export(geom_count)
224226
export(geom_crossbar)
225227
export(geom_density)
226228
export(geom_density2d)
@@ -252,16 +254,11 @@ export(geom_tile)
252254
export(geom_violin)
253255
export(geom_vline)
254256
export(gg_dep)
255-
export(ggfluctuation)
256-
export(ggmissing)
257-
export(ggorder)
258-
export(ggpcp)
259257
export(ggplot)
260258
export(ggplotGrob)
261259
export(ggplot_build)
262260
export(ggplot_gtable)
263261
export(ggsave)
264-
export(ggstructure)
265262
export(ggtitle)
266263
export(guide_colorbar)
267264
export(guide_colourbar)
@@ -286,13 +283,12 @@ export(mean_cl_normal)
286283
export(mean_sdl)
287284
export(mean_se)
288285
export(median_hilow)
289-
export(opts)
290-
export(plotmatrix)
291286
export(position_dodge)
292287
export(position_fill)
293288
export(position_identity)
294289
export(position_jitter)
295290
export(position_jitterdodge)
291+
export(position_nudge)
296292
export(position_stack)
297293
export(qplot)
298294
export(quickplot)
@@ -303,7 +299,6 @@ export(scale_alpha_continuous)
303299
export(scale_alpha_discrete)
304300
export(scale_alpha_identity)
305301
export(scale_alpha_manual)
306-
export(scale_area)
307302
export(scale_color_brewer)
308303
export(scale_color_continuous)
309304
export(scale_color_discrete)
@@ -342,6 +337,7 @@ export(scale_linetype_continuous)
342337
export(scale_linetype_discrete)
343338
export(scale_linetype_identity)
344339
export(scale_linetype_manual)
340+
export(scale_radius)
345341
export(scale_shape)
346342
export(scale_shape_continuous)
347343
export(scale_shape_discrete)
@@ -394,22 +390,16 @@ export(stat_unique)
394390
export(stat_vline)
395391
export(stat_ydensity)
396392
export(theme)
397-
export(theme_blank)
398393
export(theme_bw)
399394
export(theme_classic)
400395
export(theme_get)
401396
export(theme_gray)
402397
export(theme_grey)
403398
export(theme_light)
404-
export(theme_line)
405399
export(theme_linedraw)
406400
export(theme_minimal)
407-
export(theme_rect)
408-
export(theme_segment)
409401
export(theme_set)
410-
export(theme_text)
411402
export(theme_update)
412-
export(update_element)
413403
export(update_geom_defaults)
414404
export(update_labels)
415405
export(update_stat_defaults)

NEWS

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,53 @@
11
* Create correct legend for continuous color even if there is only one color
22
(@krlmlr, #943)
33

4+
ggplot2 1.0.1.9000
5+
----------------------------------------------------------------
6+
7+
* `aes_string()` now only parses character inputs. This problems bugs when
8+
using it with numbers and non default `OutDec` settings (#1045).
9+
10+
* `cut_number()` gives error message if insufficient data values to
11+
produce requested bins (#1046).
12+
13+
* `facet_wrap()` and `facet_grid()` now allow you to use non-standard
14+
variable names (provided that they surrounded by backticks) (#1067)
15+
16+
* Add `position_nudge()` for slightly off setting labels (or other geoms)
17+
from their corresponding points (#1109).
18+
19+
* All defunct functions and arguments have been removed.
20+
21+
* `stat_bin()` now defaults to using counts instead of proportions.
22+
`geom_count()` provides a convenient alias.
23+
24+
* `scale_size()` now maps values to _area_, not radius. Use `scale_radius()`
25+
if you want the old behaviour (not recommended, except perhaps for lines).
26+
27+
* `ggplot()` now captures the parent frame to use for evaluation,
28+
rather than always defaulting to the global environment. This should
29+
make ggplot more suitable to use in more situations (e.g. with knitr)
30+
31+
* Tweaked default `theme_grey()` background colour from grey90 to grey92:
32+
this makes the background recede into the background a little more.
33+
34+
* Bumped the default `size` for `geom_smooth()` up to 1. To continue to use
35+
the previous size, set `size = 0.5`. `geom_smooth()` gains explicit
36+
`method`, `se` and `formula` arguments to make it easier to see what the
37+
most important options are.
38+
39+
* `geom_jitter()` gains `width` and `height` arguments to make it easier
40+
to control the amount of jittering without using the lengthy
41+
`position_jitter()` function (#1116)
42+
43+
* ggplot2 now exports `alpha()` from the scales package. This means you
44+
don't need to do `library(scales)` or `scales::alpha()` to access that
45+
handy function (#1107).
46+
47+
* Improved documentation for `aes()` and many geoms and scales. I've tried
48+
to reduce the use of `...` so that you can see all the documentation in one
49+
place rather than having to navigate through multiple pages.
50+
451
ggplot2 1.0.1
552
----------------------------------------------------------------
653

R/aes-colour-fill-alpha.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' of aesthetics; colour, fill and alpha.
55
#'
66
#' @name aes_colour_fill_alpha
7-
#' @aliases colour color fill alpha
7+
#' @aliases colour color fill
88
#' @examples
99
#' \donttest{
1010
#'

R/aes.r

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@
2222
"max" = "ymax"
2323
)
2424

25-
#' Generate aesthetic mappings that describe how variables in the data are
26-
#' mapped to visual properties (aesthetics) of geoms.
25+
#' Define aesthetic mappings.
2726
#'
28-
#' \code{aes} creates a list of unevaluated expressions. This function also
29-
#' performs partial name matching, converts color to colour, and old style R
30-
#' names to ggplot names (eg. pch to shape, cex to size)
27+
#' Generate aesthetic mappings that describe how variables in the data are
28+
#' mapped to visual properties (aesthetics) of geoms. This function also
29+
#' standardise aesthetic names by performs partial name matching, converting
30+
#' color to colour, and old style R names to ggplot names (eg. pch to shape,
31+
#' cex to size)
3132
#'
32-
#' @param x,y,... List of name value pairs giving aesthetics to map.
33+
#' @param x,y,... List of name value pairs giving aesthetics to map to
34+
#' variables. The names for x and y aesthetics can be omitted (because
35+
#' they are so common); all other aesthetics must be named.
3336
#' @family aesthetic generators
3437
#' @seealso See
3538
#' \code{\link{aes_colour_fill_alpha}}, \code{\link{aes_group_order}},
@@ -38,9 +41,25 @@
3841
#' @export
3942
#' @examples
4043
#' aes(x = mpg, y = wt)
44+
#' aes(mpg, wt)
45+
#'
46+
#' # You can also map aesthetics to functions of variables
4147
#' aes(x = mpg ^ 2, y = wt / cyl)
48+
#'
49+
#' # Aesthetic names are automatically standarised
50+
#' aes(col = x)
51+
#' aes(fg = x)
52+
#' aes(color = x)
53+
#' aes(colour = x)
54+
#'
55+
#' # aes is almost always used with ggplot() or a layer
56+
#' ggplot(mpg, aes(displ, hwy)) + geom_point()
57+
#' ggplot(mpg) + geom_point(aes(displ, hwy))
58+
#'
59+
#' # Aesthetics supplied to ggplot() are used as defaults for every layer
60+
#' # you can override them, or supply different aesthetics for each layer
4261
aes <- function(x, y, ...) {
43-
aes <- structure(as.list(match.call()[-1]), class="uneval")
62+
aes <- structure(as.list(match.call()[-1]), class = "uneval")
4463
rename_aes(aes)
4564
}
4665
#' @export
@@ -79,7 +98,7 @@ is_position_aes <- function(vars) {
7998
aes_to_scale(vars) %in% c("x", "y")
8099
}
81100

82-
#' Generate aesthetic mappings from a string/quoted objects
101+
#' Define aesthetic mappings from a string/quoted objects
83102
#'
84103
#' Aesthetic mappings describe how variables in the data are mapped to visual
85104
#' properties (aesthetics) of geoms. \code{\link{aes}} uses non-standard
@@ -97,18 +116,23 @@ is_position_aes <- function(vars) {
97116
#' @export
98117
#' @examples
99118
#' # Threee ways of generating the same aesthetics
100-
#' aes(mpg, wt, col = cyl, fill = NULL)
101-
#' aes_string("mpg", "wt", col = "cyl", fill = NULL)
102-
#' aes_q(quote(mpg), quote(wt), col = quote(cyl), fill = NULL)
119+
#' aes(mpg, wt, col = cyl)
120+
#' aes_string("mpg", "wt", col = "cyl")
121+
#' aes_q(quote(mpg), quote(wt), col = quote(cyl))
103122
#'
104-
#' aes(col = cyl, fill = NULL)
105-
#' aes_string(col = "cyl", fill = NULL)
106-
#' aes_q(col = quote(cyl), fill = NULL)
123+
#' # aes_string and aes_q are most useful when you have the name of a variable
124+
#' # stored in a variable
125+
#' var <- "cyl"
126+
#' aes(col = x)
127+
#' aes_string(col = var)
128+
#' aes_q(col = as.name(var))
107129
aes_string <- function(x = NULL, y = NULL, ...) {
108130
mapping <- c(compact(list(x = x, y = y)), list(...))
109-
mapping[vapply(mapping, is.null, logical(1))] <- "NULL"
110131

111-
parsed <- lapply(mapping, function(x) parse(text = x)[[1]])
132+
parsed <- lapply(mapping, function(x) {
133+
if (!is.character(x)) return(x)
134+
parse(text = x)[[1]]
135+
})
112136
structure(rename_aes(parsed), class = "uneval")
113137
}
114138

R/coord-cartesian-.r

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#'
88
#' @param xlim limits for the x axis
99
#' @param ylim limits for the y axis
10-
#' @param wise deprecated in 0.9.1
1110
#' @export
1211
#' @examples
1312
#' # There are two ways of zooming the plot display: with scales or
@@ -37,9 +36,7 @@
3736
#' # When zooming the coordinate system, we see a subset of original 50 bins,
3837
#' # displayed bigger
3938
#' d + coord_cartesian(xlim = c(0, 2))
40-
coord_cartesian <- function(xlim = NULL, ylim = NULL, wise = NULL) {
41-
if (!is.null(wise))
42-
gg_dep("0.9.0", "wise argument to coord_cartesian is ignored")
39+
coord_cartesian <- function(xlim = NULL, ylim = NULL) {
4340
coord(limits = list(x = xlim, y = ylim), subclass = "cartesian")
4441
}
4542

R/coord-fixed.r

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
#' qplot(mpg, wt, data = mtcars) + coord_fixed(ratio = 1/5)
2222
#'
2323
#' # Resize the plot to see that the specified aspect ratio is maintained
24-
coord_fixed <- function(ratio = 1, xlim = NULL, ylim = NULL, wise = NULL) {
25-
if (!is.null(wise))
26-
gg_dep("0.9.0", "wise argument to coord_cartesian is ignored")
27-
24+
coord_fixed <- function(ratio = 1, xlim = NULL, ylim = NULL) {
2825
coord(limits = list(x = xlim, y = ylim), ratio = ratio,
2926
subclass = c("fixed", "cartesian"))
3027
}

R/facet-layout.r

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ layout_grid <- function(data, rows = NULL, cols = NULL, margins = NULL, drop = T
3131
rows <- if (is.null(names(rows))) 1L else id(base[names(rows)], drop = TRUE)
3232
cols <- if (is.null(names(cols))) 1L else id(base[names(cols)], drop = TRUE)
3333

34-
panels <- data.frame(PANEL = panel, ROW = rows, COL = cols, base)
34+
panels <- data.frame(PANEL = panel, ROW = rows, COL = cols, base,
35+
check.names = FALSE)
3536
panels <- panels[order(panels$PANEL), , drop = FALSE]
3637
rownames(panels) <- NULL
3738
panels
@@ -148,7 +149,7 @@ df.grid <- function(a, b) {
148149

149150
quoted_df <- function(data, vars) {
150151
values <- eval.quoted(vars, data, emptyenv(), try = TRUE)
151-
as.data.frame(compact(values))
152+
as.data.frame(compact(values), optional = TRUE)
152153
}
153154

154155
# Arrange 1d structure into a grid

0 commit comments

Comments
 (0)