Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Bug fixes

* Using infinite `radius` aesthetic in `geom_spoke()` now throws a warning
(#6671)
* Fixed regression where `draw_key_rect()` stopped using `fill` colours
(@mitchelloharawild, #6609).
* Fixed regression where `scale_{x,y}_*()` threw an error when an expression
Expand Down
4 changes: 4 additions & 0 deletions R/geom-spoke.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ GeomSpoke <- ggproto(
data$radius <- data$radius %||% params$radius
data$angle <- data$angle %||% params$angle

if (any(is.infinite(data$radius))) {
cli::cli_warn("Infinite {.field radius} values are unreliable.")
}

transform(data,
xend = x + cos(angle) * radius,
yend = y + sin(angle) * radius
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/_snaps/geom-spoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# geom_spoke warns about infinite radius (#6671)

Infinite radius values are unreliable.

4 changes: 4 additions & 0 deletions tests/testthat/test-geom-spoke.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test_that("geom_spoke warns about infinite radius (#6671)", {
p <- ggplot() + geom_spoke(aes(0, 0, angle = pi / 4, radius = Inf))
expect_snapshot_warning(ggplot_build(p))
})