Skip to content

Commit

Permalink
pass r cmd check
Browse files Browse the repository at this point in the history
  • Loading branch information
nrennie committed Dec 23, 2024
1 parent 2959c25 commit f482087
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 33 deletions.
3 changes: 0 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@ Imports:
grDevices,
igraph,
lwgeom,
magick,
patchwork,
purrr,
sf,
stats,
stringr,
terra,
tibble,
tidygraph,
tidyr,
tidyterra,
treemapify,
withr
Suggests:
Expand Down
4 changes: 2 additions & 2 deletions R/blending.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ blending <- function(n = 100,
plot_data <- withr::with_seed(
seed = s,
code = {
walks <- unlist(purrr::map(.x = 1:n, .f = ~ blending_walk(n = n, s = s + .x)))
walks <- unlist(purrr::map(.x = 1:n, .f = ~ blending_walk(n = n)))
plot_data <- expand.grid(x = 1:n, y = 1:n)
plot_data$colour <- walks
plot_data
Expand All @@ -50,6 +50,6 @@ blending <- function(n = 100,
ggplot2::geom_raster(interpolate = TRUE) +
ggplot2::coord_flip(expand = FALSE) +
ggplot2::scale_fill_gradient(low = down, high = up) +
theme_aRt(bg_col)
theme_aRt("transparent")
return(p)
}
4 changes: 3 additions & 1 deletion R/boxes.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ boxes <- function(n = 100,
q <- p +
inset_element(p1, left = 0.1, bottom = 0.1, right = 1.1, top = 1.1) +
inset_element(p1, left = -0.1, bottom = -0.1, right = 0.9, top = 0.9) &
theme(plot.margin = unit(c(-0.5, -0.5, -0.5, -0.5), "cm"))
ggplot2::theme(
plot.margin = ggplot2::unit(c(-0.5, -0.5, -0.5, -0.5), "cm")
)
return(q)
}
16 changes: 8 additions & 8 deletions R/bullseye.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ bullseye <- function(main_col = "black",
)
p1 <- ggplot2::ggplot() +
ggplot2::geom_bar(
data = dplyr::filter(plot_data, grp == 1),
data = dplyr::filter(plot_data, .data$grp == 1),
mapping = ggplot2::aes(x = as.factor(.data$id), y = .data$value),
stat = "identity",
width = 1,
fill = ggplot2::alpha(main_col, 0.3)
) +
ggplot2::geom_bar(
data = dplyr::filter(plot_data, grp == 2),
data = dplyr::filter(plot_data, .data$grp == 2),
mapping = ggplot2::aes(x = as.factor(.data$id), y = .data$value),
stat = "identity",
width = 0.2,
Expand All @@ -49,14 +49,14 @@ bullseye <- function(main_col = "black",
theme_aRt(bg_col, -0.5)
p2 <- ggplot2::ggplot() +
ggplot2::geom_bar(
data = dplyr::filter(plot_data, grp == 3),
data = dplyr::filter(plot_data, .data$grp == 3),
mapping = ggplot2::aes(x = as.factor(.data$id), y = .data$value),
stat = "identity",
width = 1,
fill = ggplot2::alpha(main_col, 0.3)
) +
ggplot2::geom_bar(
data = dplyr::filter(plot_data, grp == 4),
data = dplyr::filter(plot_data, .data$grp == 4),
mapping = ggplot2::aes(x = as.factor(.data$id), y = .data$value),
stat = "identity",
width = 0.2,
Expand All @@ -67,14 +67,14 @@ bullseye <- function(main_col = "black",
theme_aRt("transparent", -0.5)
p3 <- ggplot2::ggplot() +
ggplot2::geom_bar(
data = dplyr::filter(plot_data, grp == 5),
data = dplyr::filter(plot_data, .data$grp == 5),
mapping = ggplot2::aes(x = as.factor(.data$id), y = .data$value),
stat = "identity",
width = 1,
fill = ggplot2::alpha(main_col, 0.3)
) +
ggplot2::geom_bar(
data = dplyr::filter(plot_data, grp == 6),
data = dplyr::filter(plot_data, .data$grp == 6),
mapping = ggplot2::aes(x = as.factor(.data$id), y = .data$value),
stat = "identity",
width = 0.2,
Expand All @@ -85,14 +85,14 @@ bullseye <- function(main_col = "black",
theme_aRt("transparent", -0.5)
p4 <- ggplot2::ggplot() +
ggplot2::geom_bar(
data = dplyr::filter(plot_data, grp == 7),
data = dplyr::filter(plot_data, .data$grp == 7),
mapping = ggplot2::aes(x = as.factor(.data$id), y = .data$value),
stat = "identity",
width = 1,
fill = ggplot2::alpha(main_col, 0.3)
) +
ggplot2::geom_bar(
data = dplyr::filter(plot_data, grp == 8),
data = dplyr::filter(plot_data, .data$grp == 8),
mapping = ggplot2::aes(x = as.factor(.data$id), y = .data$value),
stat = "identity",
width = 0.2,
Expand Down
2 changes: 1 addition & 1 deletion R/globalVariables.R
Original file line number Diff line number Diff line change
@@ -1 +1 @@
globalVariables(c("density", "."))
utils::globalVariables(c("density", ".", ".data"))
6 changes: 3 additions & 3 deletions R/spirals.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spirals <- function(perc = 0.3,
df$size_val <- (40 - 0) * stats::rbeta(n = length(theta), shape1 = 3, shape2 = 9) + 0
plot_data <- df |>
tidyr::drop_na() |>
dplyr::filter(abs(x) <= limit, abs(y) <= limit)
dplyr::filter(abs(.data$x) <= limit, abs(.data$y) <= limit)
plot_data
}
)
Expand Down Expand Up @@ -71,8 +71,8 @@ spirals <- function(perc = 0.3,
size = 0.1
) +
ggplot2::scale_colour_gradientn(colors = col_palette) +
scale_x_continuous(limits = c(-limit, limit)) +
scale_y_continuous(limits = c(-limit, limit)) +
ggplot2::scale_x_continuous(limits = c(-limit, limit)) +
ggplot2::scale_y_continuous(limits = c(-limit, limit)) +
ggplot2::coord_fixed(expand = FALSE) +
ggplot2::scale_size(range = c(0, max_size)) +
theme_aRt(bg_col)
Expand Down
2 changes: 1 addition & 1 deletion R/squiggles.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ squiggles <- function(res = 100,
y = unlist(all_lines),
group = factor(rep(1:num_lines, each = res)),
) |>
dplyr::group_by(group) |>
dplyr::group_by(.data$group) |>
dplyr::mutate(
alpha = stats::runif(1, alpha_low, alpha_high)
) |>
Expand Down
10 changes: 6 additions & 4 deletions R/streams.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ streams <- function(bg_col = "white",
theme_aRt(bg_col)
# rotate
if (type == "up") {
p <- p + coord_flip(expand = FALSE)
p <- p + ggplot2::coord_flip(expand = FALSE)
} else if (type == "left") {
p <- p + coord_cartesian(expand = FALSE) + scale_x_reverse()
p <- p + ggplot2::coord_cartesian(expand = FALSE) +
ggplot2::scale_x_reverse()
} else if (type == "down") {
p <- p + coord_flip(expand = FALSE) + scale_x_reverse()
p <- p + ggplot2::coord_flip(expand = FALSE) +
ggplot2::scale_x_reverse()
} else if (type == "right") {
p <- p + coord_cartesian(expand = FALSE)
p <- p + ggplot2::coord_cartesian(expand = FALSE)
}
return(p)
}
Expand Down
4 changes: 2 additions & 2 deletions R/sunbursts.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ sunbursts <- function(ncol = 4,
low = "#4e0550",
high = "#facdfc",
s = 1234) {
plot_data <- withr::with_seed(
p <- withr::with_seed(
seed = s,
code = {
ss <- sample(5:100, size = ncol * nrow)
Expand All @@ -101,7 +101,7 @@ sunbursts <- function(ncol = 4,
s = i
)
})
plot_data
p
}
)

Expand Down
10 changes: 5 additions & 5 deletions R/tiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ tiles <- function(n_x = 12,
tibble::as_tibble() |>
dplyr::rowwise() |>
dplyr::mutate(cols = stringr::str_flatten(sample(col_palette, 3), "-")) |>
tidyr::separate_wider_delim(cols,
tidyr::separate_wider_delim(.data$cols,
delim = "-",
names = c("col1", "col2", "col3")
)
Expand All @@ -39,20 +39,20 @@ tiles <- function(n_x = 12,
)
p <- ggplot2::ggplot(
data = plot_data,
mapping = ggplot2::aes(x = x, y = y)
mapping = ggplot2::aes(x = .data$x, y = .data$y)
) +
ggplot2::geom_tile(
mapping = ggplot2::aes(fill = col1),
mapping = ggplot2::aes(fill = .data$col1),
width = 1, height = 1,
colour = NA
) +
ggplot2::geom_tile(
mapping = ggplot2::aes(fill = col2),
mapping = ggplot2::aes(fill = .data$col2),
width = (2 / 3), height = (2 / 3),
colour = NA
) +
ggplot2::geom_tile(
mapping = ggplot2::aes(fill = col3),
mapping = ggplot2::aes(fill = .data$col3),
width = (1 / 3), height = (1 / 3),
colour = NA
) +
Expand Down
9 changes: 6 additions & 3 deletions man/stacked.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f482087

Please sign in to comment.