Skip to content

Commit 88b1675

Browse files
committed
smarter defaults for negative.small
1 parent 4383b51 commit 88b1675

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

R/guide-axis-logticks.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ NULL
1717
#' keep the default `NULL` argument.
1818
#' @param negative.small When the scale limits include 0 or negative numbers,
1919
#' what should be the smallest absolute value that is marked with a tick?
20+
#' If `NULL` (default), will be the smallest of 0.1 or 0.1 times the absolute
21+
#' scale maximum.
2022
#' @param short.theme A theme [element][element_line()] for customising the
2123
#' display of the shortest ticks. Must be a line or blank element, and
2224
#' it inherits from the `axis.minor.ticks` setting for the relevant position.
@@ -69,7 +71,7 @@ guide_axis_logticks <- function(
6971
mid = 1.5,
7072
short = 0.75,
7173
prescale.base = NULL,
72-
negative.small = 0.1,
74+
negative.small = NULL,
7375
short.theme = element_line(),
7476
expanded = TRUE,
7577
cap = "none",
@@ -189,7 +191,7 @@ GuideAxisLogticks <- ggproto(
189191
has_negatives <- any(limits <= 0)
190192
if (has_negatives) {
191193
large <- max(abs(limits))
192-
small <- params$negative_small %||% 0.1
194+
small <- params$negative_small %||% min(c(1, large) * 0.1)
193195
limits <- sort(c(small * 10, large))
194196
}
195197

man/guide_axis_logticks.Rd

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)