seq function calls should use full name of 'length.out' (#3817)

This commit is contained in:
Barret Schloerke 2020-02-11 23:06:56 -05:00 committed by GitHub
parent 0137a4d7a2
commit 2ae36a20bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -135,7 +135,7 @@ write_icon("geom_bar", {
write_icon("geom_bin2d", {
n <- 5
x <- seq(0, 1, length = n + 1)[-(n + 1)]
x <- seq(0, 1, length.out = n + 1)[-(n + 1)]
out <- expand.grid(x = x, y = x)
fill <- sqrt((out$x - 0.5) ^ 2 + (out$y - 0.5) ^ 2)
@ -239,7 +239,7 @@ write_icon("geom_contour", {
})
write_icon("geom_hex", {
theta <- seq(0, 2 * pi, length = 7)[-1]
theta <- seq(0, 2 * pi, length.out = 7)[-1]
polygonGrob(
0.5 + 0.4 * sin(theta),
0.5 + 0.4 * cos(theta),
@ -343,8 +343,8 @@ write_icon("geom_ribbon", {
})
write_icon("geom_spoke", {
theta <- seq(0, 2 * pi, length = 10)[-1]
r <- seq(0.1, 0.45, length = length(theta))
theta <- seq(0, 2 * pi, length.out = 10)[-1]
r <- seq(0.1, 0.45, length.out = length(theta))
segmentsGrob(
0.5, 0.5,
0.5 + sin(theta) * r,
@ -367,7 +367,7 @@ write_icon("geom_density", {
write_icon("geom_rug", {
x <- seq(0.15, 0.95, length = 8)
x <- seq(0.15, 0.95, length.out = 8)
gList(
segmentsGrob(x, 0, x, 0 + 0.1, gp = gpar(lwd = 2)),
segmentsGrob(0, x, 0 + 0.1, x, gp = gpar(lwd = 2))

View File

@ -18,7 +18,7 @@ test_that("aesthetic parameters match length of data", {
test_that("legend filters out aesthetics not of length 1", {
df <- data_frame(x = 1:5, y = 1:5)
p <- ggplot(df, aes(x, y, colour = factor(x))) +
geom_point(alpha = seq(0, 1, length = 5))
geom_point(alpha = seq(0, 1, length.out = 5))
# Ideally would test something in the legend data structure, but
# that's not easily accessible currently.

View File

@ -18,11 +18,11 @@ test_that("geom_quantile matches quantile regression", {
data = df
),
tibble::tibble(
x = seq(min(x), max(x), length = 100)
x = seq(min(x), max(x), length.out = 100)
)
)
pred_rq <- cbind(seq(min(x), max(x), length = 100), pred_rq)
pred_rq <- cbind(seq(min(x), max(x), length.out = 100), pred_rq)
colnames(pred_rq) <- c("x", paste("Q", quants * 100, sep = "_"))
ggplot_data <- tibble::as_tibble(layer_data(ps))