Skip to content

Commit 0406725

Browse files
committed
Fix line widths
1 parent a0e9d1c commit 0406725

17 files changed

+75
-37
lines changed

R/aes-position.r

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,29 @@
2020
#' # generate sample data
2121
#' library(plyr)
2222
#' abc <- adply(matrix(rnorm(100), ncol = 5), 2, quantile, c(0, .25, .5, .75, 1))
23-
#' b <- ggplot(abc, aes(x = X1, ymin = "0%", lower = "25%", middle = "50%", upper = "75%", ymax = "100%"))
23+
#' b <- ggplot(abc, aes(x = X1, ymin = "0%", lower = "25%",
24+
#' middle = "50%", upper = "75%", ymax = "100%"))
2425
#' b + geom_boxplot(stat = "identity")
2526
#'
2627
#' # Using annotate
2728
#' p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
28-
#' p + annotate("rect", xmin = 2, xmax = 3.5, ymin = 2, ymax = 25, fill = "dark grey", alpha = .5)
29+
#' p + annotate("rect", xmin = 2, xmax = 3.5, ymin = 2, ymax = 25,
30+
#' fill = "dark grey", alpha = .5)
2931
#'
3032
#' # Geom_segment examples
3133
#' library(grid)
32-
#' p + geom_segment(aes(x = 2, y = 15, xend = 2, yend = 25), arrow = arrow(length = unit(0.5, "cm")))
33-
#' p + geom_segment(aes(x = 2, y = 15, xend = 3, yend = 15), arrow = arrow(length = unit(0.5, "cm")))
34-
#' p + geom_segment(aes(x = 5, y = 30, xend = 3.5, yend = 25), arrow = arrow(length = unit(0.5, "cm")))
34+
#' p + geom_segment(aes(x = 2, y = 15, xend = 2, yend = 25),
35+
#' arrow = arrow(length = unit(0.5, "cm")))
36+
#' p + geom_segment(aes(x = 2, y = 15, xend = 3, yend = 15),
37+
#' arrow = arrow(length = unit(0.5, "cm")))
38+
#' p + geom_segment(aes(x = 5, y = 30, xend = 3.5, yend = 25),
39+
#' arrow = arrow(length = unit(0.5, "cm")))
3540
#'
3641
#' # You can also use geom_segment to recreate plot(type = "h") :
3742
#' counts <- as.data.frame(table(x = rpois(100, 5)))
3843
#' counts$x <- as.numeric(as.character(counts$x))
3944
#' with(counts, plot(x, Freq, type = "h", lwd = 10))
4045
#'
41-
#' qplot(x, Freq, data = counts, geom = "segment", yend = 0, xend = x, size = I(10))
46+
#' qplot(x, Freq, data = counts, geom = "segment", yend = 0, xend = x,
47+
#' size = I(10))
4248
NULL

R/geom-boxplot.r

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@
9292
#' # Using precomputed statistics
9393
#' # generate sample data
9494
#' abc <- adply(matrix(rnorm(100), ncol = 5), 2, quantile, c(0, .25, .5, .75, 1))
95-
#' b <- ggplot(abc, aes(x = X1, ymin = `0%`, lower = `25%`, middle = `50%`, upper = `75%`, ymax = `100%`))
95+
#' b <- ggplot(abc, aes(x = X1, ymin = `0%`, lower = `25%`,
96+
#' middle = `50%`, upper = `75%`, ymax = `100%`))
9697
#' b + geom_boxplot(stat = "identity")
9798
#' b + geom_boxplot(stat = "identity") + coord_flip()
9899
#' b + geom_boxplot(aes(fill = X1), stat = "identity")

R/geom-linerange.r

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
#' # Generate data: means and standard errors of means for prices
1515
#' # for each type of cut
1616
#' dmod <- lm(price ~ cut, data=diamonds)
17-
#' cuts <- data.frame(cut=unique(diamonds$cut), predict(dmod, data.frame(cut = unique(diamonds$cut)), se=TRUE)[c("fit","se.fit")])
17+
#' cuts <- data.frame(cut = unique(diamonds$cut),
18+
#' predict(dmod, data.frame(cut = unique(diamonds$cut)), se=TRUE)[c("fit","se.fit")])
1819
#'
1920
#' qplot(cut, fit, data=cuts)
2021
#' # With a bar chart, we are comparing lengths, so the y-axis is

R/geom-map.r

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,15 @@ NULL
5050
#' crimesm <- melt(crimes, id = 1)
5151
#' if (require(maps)) {
5252
#' states_map <- map_data("state")
53-
#' ggplot(crimes, aes(map_id = state)) + geom_map(aes(fill = Murder), map = states_map) + expand_limits(x = states_map$long, y = states_map$lat)
53+
#' ggplot(crimes, aes(map_id = state)) +
54+
#' geom_map(aes(fill = Murder), map = states_map) +
55+
#' expand_limits(x = states_map$long, y = states_map$lat)
56+
#'
5457
#' last_plot() + coord_map()
55-
#' ggplot(crimesm, aes(map_id = state)) + geom_map(aes(fill = value), map = states_map) + expand_limits(x = states_map$long, y = states_map$lat) + facet_wrap( ~ variable)
58+
#' ggplot(crimesm, aes(map_id = state)) +
59+
#' geom_map(aes(fill = value), map = states_map) +
60+
#' expand_limits(x = states_map$long, y = states_map$lat) +
61+
#' facet_wrap( ~ variable)
5662
#' }
5763
geom_map <- function(mapping = NULL, data = NULL, map, stat = "identity", ...) {
5864

R/geom-segment.r

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#' @examples
1313
#' library(grid) # needed for arrow function
1414
#' p <- ggplot(seals, aes(x = long, y = lat))
15-
#' (p <- p + geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat), arrow = arrow(length = unit(0.1,"cm"))))
15+
#' (p <- p + geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat),
16+
#' arrow = arrow(length = unit(0.1,"cm"))))
1617
#'
1718
#' if (require("maps")) {
1819
#'
@@ -40,7 +41,8 @@
4041
#' b <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
4142
#' b + geom_segment(aes(x = 2, y = 15, xend = 2, yend = 25))
4243
#' b + geom_segment(aes(x = 2, y = 15, xend = 3, yend = 15))
43-
#' b + geom_segment(aes(x = 5, y = 30, xend = 3.5, yend = 25), arrow = arrow(length = unit(0.5, "cm")))
44+
#' b + geom_segment(aes(x = 5, y = 30, xend = 3.5, yend = 25),
45+
#' arrow = arrow(length = unit(0.5, "cm")))
4446
geom_segment <- function (mapping = NULL, data = NULL, stat = "identity",
4547
position = "identity", arrow = NULL, lineend = "butt", na.rm = FALSE, ...) {
4648

R/geom-tile.r

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
#' # You can manually set the colour of the tiles using
6666
#' # scale_manual
6767
#' col <- c("darkblue", "blue", "green", "orange", "red")
68-
#' qplot(x, y, fill=col[z], data=example, geom="tile", width=w, group=1) + scale_fill_identity(labels=letters[1:5], breaks=col)
68+
#' qplot(x, y, fill=col[z], data=example, geom="tile", width=w, group=1) +
69+
#' scale_fill_identity(labels=letters[1:5], breaks=col)
6970
#' }
7071
geom_tile <- function (mapping = NULL, data = NULL, stat = "identity", position = "identity", ...) {
7172
GeomTile$new(mapping = mapping, data = data, stat = stat, position = position, ...)

R/guide-legend.r

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,3 +516,5 @@ guide_gengrob.legend <- function(guide, theme) {
516516

517517
gt
518518
}
519+
520+
globalVariables(c("R", "key.row", "key.col", "label.row", "label.col"))

R/stat-function.r

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@
3030
#' # Or
3131
#' qplot(c(-5, 5), geom = "blank") + stat_function(fun = dnorm)
3232
#' # To specify a different mean or sd, use the args parameter to supply new values
33-
#' ggplot(data.frame(x = c(-5, 5)), aes(x)) + stat_function(fun = dnorm, args = list(mean = 2, sd = .5))
33+
#' ggplot(data.frame(x = c(-5, 5)), aes(x)) +
34+
#' stat_function(fun = dnorm, args = list(mean = 2, sd = .5))
3435
#'
3536
#' # Two functions on the same plot
3637
#' f <- ggplot(data.frame(x = c(0, 10)), aes(x))
37-
#' f + stat_function(fun = sin, colour = "red") + stat_function(fun = cos, colour = "blue")
38+
#' f + stat_function(fun = sin, colour = "red") +
39+
#' stat_function(fun = cos, colour = "blue")
3840
#'
3941
#' # Using a custom function
4042
#' test <- function(x) {x ^ 2 + x + 20}

man/aes_position.Rd

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,30 @@ se + geom_pointrange()
2828
# generate sample data
2929
library(plyr)
3030
abc <- adply(matrix(rnorm(100), ncol = 5), 2, quantile, c(0, .25, .5, .75, 1))
31-
b <- ggplot(abc, aes(x = X1, ymin = "0\%", lower = "25\%", middle = "50\%", upper = "75\%", ymax = "100\%"))
31+
b <- ggplot(abc, aes(x = X1, ymin = "0\%", lower = "25\%",
32+
middle = "50\%", upper = "75\%", ymax = "100\%"))
3233
b + geom_boxplot(stat = "identity")
3334

3435
# Using annotate
3536
p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
36-
p + annotate("rect", xmin = 2, xmax = 3.5, ymin = 2, ymax = 25, fill = "dark grey", alpha = .5)
37+
p + annotate("rect", xmin = 2, xmax = 3.5, ymin = 2, ymax = 25,
38+
fill = "dark grey", alpha = .5)
3739

3840
# Geom_segment examples
3941
library(grid)
40-
p + geom_segment(aes(x = 2, y = 15, xend = 2, yend = 25), arrow = arrow(length = unit(0.5, "cm")))
41-
p + geom_segment(aes(x = 2, y = 15, xend = 3, yend = 15), arrow = arrow(length = unit(0.5, "cm")))
42-
p + geom_segment(aes(x = 5, y = 30, xend = 3.5, yend = 25), arrow = arrow(length = unit(0.5, "cm")))
42+
p + geom_segment(aes(x = 2, y = 15, xend = 2, yend = 25),
43+
arrow = arrow(length = unit(0.5, "cm")))
44+
p + geom_segment(aes(x = 2, y = 15, xend = 3, yend = 15),
45+
arrow = arrow(length = unit(0.5, "cm")))
46+
p + geom_segment(aes(x = 5, y = 30, xend = 3.5, yend = 25),
47+
arrow = arrow(length = unit(0.5, "cm")))
4348

4449
# You can also use geom_segment to recreate plot(type = "h") :
4550
counts <- as.data.frame(table(x = rpois(100, 5)))
4651
counts$x <- as.numeric(as.character(counts$x))
4752
with(counts, plot(x, Freq, type = "h", lwd = 10))
4853

49-
qplot(x, Freq, data = counts, geom = "segment", yend = 0, xend = x, size = I(10))
54+
qplot(x, Freq, data = counts, geom = "segment", yend = 0, xend = x,
55+
size = I(10))
5056
}
5157

man/geom_boxplot.Rd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ qplot(year, budget, data = movies, geom = "boxplot",
117117
# Using precomputed statistics
118118
# generate sample data
119119
abc <- adply(matrix(rnorm(100), ncol = 5), 2, quantile, c(0, .25, .5, .75, 1))
120-
b <- ggplot(abc, aes(x = X1, ymin = `0\%`, lower = `25\%`, middle = `50\%`, upper = `75\%`, ymax = `100\%`))
120+
b <- ggplot(abc, aes(x = X1, ymin = `0\%`, lower = `25\%`,
121+
middle = `50\%`, upper = `75\%`, ymax = `100\%`))
121122
b + geom_boxplot(stat = "identity")
122123
b + geom_boxplot(stat = "identity") + coord_flip()
123124
b + geom_boxplot(aes(fill = X1), stat = "identity")

0 commit comments

Comments
 (0)