Skip to content

Commit 1f2a2ef

Browse files
authored
annotation_logticks() skips panels with non-finite range (#5232)
* only draw ticks when range is finite * Add NEWS bullet
1 parent f139f40 commit 1f2a2ef

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ggplot2 (development version)
22

3+
* `annotation_logticks()` skips drawing ticks when the scale range is non-finite
4+
instead of throwing an error (@teunbrand, #5229).
35
* Fixed spurious warnings when the `weight` was used in `stat_bin_2d()`,
46
`stat_boxplot()`, `stat_contour()`, `stat_bin_hex()` and `stat_quantile()`
57
(@teunbrand, #5216).

R/annotation-logticks.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,
135135
mid <- convertUnit(mid, "cm", valueOnly = TRUE)
136136
long <- convertUnit(long, "cm", valueOnly = TRUE)
137137

138-
if (grepl("[b|t]", sides)) {
138+
if (grepl("[b|t]", sides) && all(is.finite(panel_params$x.range))) {
139139

140140
# Get positions of x tick marks
141141
xticks <- calc_logticks(
@@ -175,7 +175,7 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,
175175
}
176176
}
177177

178-
if (grepl("[l|r]", sides)) {
178+
if (grepl("[l|r]", sides) && all(is.finite(panel_params$y.range))) {
179179
yticks <- calc_logticks(
180180
base = base,
181181
minpow = floor(panel_params$y.range[1]),

0 commit comments

Comments
 (0)