Skip to content
Merged
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
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@
than `origin`, following in `stat_bin()`'s footsteps (@teunbrand).
* `stat_summary_2d()` and `stat_bin_2d()` now deal with zero-range data
more elegantly (@teunbrand, #6207).
* Munching in `coord_polar()` and `coord_radial()` now adds more detail,
particularly for data-points with a low radius near the center
(@teunbrand, #5023).

# ggplot2 3.5.1

Expand Down
6 changes: 3 additions & 3 deletions R/coord-polar.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ CoordPolar <- ggproto("CoordPolar", Coord,

is_free = function() TRUE,

distance = function(self, x, y, details) {
distance = function(self, x, y, details, boost = 0.75) {
arc <- self$start + c(0, 2 * pi)
dir <- self$direction
if (self$theta == "x") {
Expand All @@ -94,8 +94,8 @@ CoordPolar <- ggproto("CoordPolar", Coord,
r <- rescale(x, from = details$r.range)
theta <- theta_rescale_no_clip(y, details$theta.range, arc, dir)
}

dist_polar(r, theta)
# The ^boost boosts detailed munching when r is small
dist_polar(r^boost, theta)
},

backtransform_range = function(self, panel_params) {
Expand Down
6 changes: 3 additions & 3 deletions R/coord-radial.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ CoordRadial <- ggproto("CoordRadial", Coord,

is_free = function() TRUE,

distance = function(self, x, y, details) {
distance = function(self, x, y, details, boost = 0.75) {
arc <- details$arc %||% c(0, 2 * pi)
if (self$theta == "x") {
r <- rescale(y, from = details$r.range, to = self$inner_radius / 0.4)
Expand All @@ -129,8 +129,8 @@ CoordRadial <- ggproto("CoordRadial", Coord,
r <- rescale(x, from = details$r.range, to = self$inner_radius / 0.4)
theta <- theta_rescale_no_clip(y, details$theta.range, arc)
}

dist_polar(r, theta)
# The ^boost boosts detailed munching when r is small
dist_polar(r^boost, theta)
},

backtransform_range = function(self, panel_params) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading