From c70a2bc35c19c98619129ac4edb8eecaa8778ec7 Mon Sep 17 00:00:00 2001 From: Javlon Isomurodov Date: Sun, 7 Aug 2022 23:59:45 +0500 Subject: [PATCH 1/2] fix dropping of inf values from jitter plot --- R/position-jitter.r | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/position-jitter.r b/R/position-jitter.r index 66f4694cad..a72a38378f 100644 --- a/R/position-jitter.r +++ b/R/position-jitter.r @@ -87,6 +87,9 @@ PositionJitter <- ggproto("PositionJitter", Position, fixed_jitter <- with_seed_null(params$seed, transform_position(dummy_data, trans_x, trans_y)) x_jit <- fixed_jitter$x - x y_jit <- fixed_jitter$y - y + # Avoid nan values, if x or y has Inf values + x_jit[is.infinite(x)] <- 0 + y_jit[is.infinite(y)] <- 0 # Apply jitter transform_position(data, function(x) x + x_jit, function(x) x + y_jit) From 3f2a2f2ef320a85ba0949de476125ae9babeb1f5 Mon Sep 17 00:00:00 2001 From: Javlon Isomurodov Date: Thu, 11 Aug 2022 22:38:22 +0500 Subject: [PATCH 2/2] add change info as a bullet in news --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 83cd1abcd5..d3d9ceb105 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # ggplot2 (development version) +* Fix a bug in `position_jitter()` where infinity values were dropped (@javlon, + #4790). + * `geom_linerange()` now respects the `na.rm` argument (#4927, @thomasp85) * Improve the support for `guide_axis()` on `coord_trans()` (@yutannihilation, #3959)