10
10
# ' the (relative) length of the long, middle and short ticks. Numeric values
11
11
# ' are interpreted as [rel()] objects. The [rel()] values are used to multiply
12
12
# ' values of the `axis.ticks.length` theme setting.
13
- # ' @param prescale_base Base of logarithm used to transform data manually. The
13
+ # ' @param prescale.base Base of logarithm used to transform data manually. The
14
14
# ' default, `NULL`, will use the scale transformation to calculate positions.
15
- # ' Only set `prescale_base ` if the data has already been log-transformed.
15
+ # ' Only set `prescale.base ` if the data has already been log-transformed.
16
16
# ' When using a log-transform in the position scale or in `coord_trans()`,
17
17
# ' keep the default `NULL` argument.
18
- # ' @param negative_small When the scale limits include 0 or negative numbers,
18
+ # ' @param negative.small When the scale limits include 0 or negative numbers,
19
19
# ' what should be the smallest absolute value that is marked with a tick?
20
- # ' @param short_theme A theme [element][element_line()] for customising the
20
+ # ' @param short.theme A theme [element][element_line()] for customising the
21
21
# ' display of the shortest ticks. Must be a line or blank element, and
22
22
# ' it inherits from the `axis.minor.ticks` setting for the relevant position.
23
23
# ' @param expanded Whether the ticks should cover the range after scale
24
24
# ' expansion (`TRUE`, default), or be restricted to the scale limits
25
25
# ' (`FALSE`).
26
+ # ' @param prescale_base,negative_small,short_theme `r lifecycle::badge("deprecated")`
26
27
# ' @inheritParams guide_axis
27
28
# ' @inheritDotParams guide_axis -minor.ticks
28
29
# '
41
42
# ' p + coord_trans(x = "log10", y = "log10") +
42
43
# ' guides(x = "axis_logticks", y = "axis_logticks")
43
44
# '
44
- # ' # When data is transformed manually, one should provide `prescale_base `
45
+ # ' # When data is transformed manually, one should provide `prescale.base `
45
46
# ' # Keep in mind that this axis uses log10 space for placement, not log2
46
47
# ' p + aes(x = log2(bodywt), y = log10(brainwt)) +
47
48
# ' guides(
48
- # ' x = guide_axis_logticks(prescale_base = 2),
49
- # ' y = guide_axis_logticks(prescale_base = 10)
49
+ # ' x = guide_axis_logticks(prescale.base = 2),
50
+ # ' y = guide_axis_logticks(prescale.base = 10)
50
51
# ' )
51
52
# '
52
53
# ' # A plot with both positive and negative extremes, pseudo-log transformed
61
62
# ' # The log ticks are mirrored when 0 is included
62
63
# ' p2 + guides(x = "axis_logticks")
63
64
# '
64
- # ' # To control the tick density around 0, one can set `negative_small `
65
- # ' p2 + guides(x = guide_axis_logticks(negative_small = 1))
65
+ # ' # To control the tick density around 0, one can set `negative.small `
66
+ # ' p2 + guides(x = guide_axis_logticks(negative.small = 1))
66
67
guide_axis_logticks <- function (
67
68
long = 2.25 ,
68
69
mid = 1.5 ,
69
70
short = 0.75 ,
70
- prescale_base = NULL ,
71
- negative_small = 0.1 ,
72
- short_theme = element_line(),
71
+ prescale.base = NULL ,
72
+ negative.small = 0.1 ,
73
+ short.theme = element_line(),
73
74
expanded = TRUE ,
74
75
cap = " none" ,
75
76
theme = NULL ,
77
+ prescale_base = deprecated(),
78
+ negative_small = deprecated(),
79
+ short_theme = deprecated(),
76
80
...
77
81
) {
82
+ if (lifecycle :: is_present(prescale_base )) {
83
+ deprecate_warn0(
84
+ " 3.5.1" , " guide_axis_logticks(prescale_base)" , " guide_axis_logticks(prescale.base)"
85
+ )
86
+ prescale.base <- prescale_base
87
+ }
88
+ if (lifecycle :: is_present(negative_small )) {
89
+ deprecate_warn0(
90
+ " 3.5.1" , " guide_axis_logticks(negative_small)" , " guide_axis_logticks(negative.small)"
91
+ )
92
+ negative.small <- negative_small
93
+ }
94
+ if (lifecycle :: is_present(short_theme )) {
95
+ deprecate_warn0(
96
+ " 3.5.1" , " guide_axis_logticks(short_theme)" , " guide_axis_logticks(short.theme)"
97
+ )
98
+ short.theme <- short_theme
99
+ }
100
+
78
101
if (is.logical(cap )) {
79
102
check_bool(cap )
80
103
cap <- if (cap ) " both" else " none"
@@ -91,24 +114,24 @@ guide_axis_logticks <- function(
91
114
check_object(mid , check_fun , what )
92
115
check_object(short , check_fun , what )
93
116
check_number_decimal(
94
- negative_small , min = 1e-100 , # minimal domain of scales::log_trans
117
+ negative.small , min = 1e-100 , # minimal domain of scales::log_trans
95
118
allow_infinite = FALSE ,
96
119
allow_null = TRUE
97
120
)
98
121
check_bool(expanded )
99
- check_inherits(short_theme , c(" element_blank" , " element_line" ))
122
+ check_inherits(short.theme , c(" element_blank" , " element_line" ))
100
123
101
124
new_guide(
102
125
available_aes = c(" x" , " y" ),
103
- prescale_base = prescale_base ,
104
- negative_small = negative_small ,
126
+ prescale_base = prescale.base ,
127
+ negative_small = negative.small ,
105
128
expanded = expanded ,
106
129
long = long ,
107
130
mid = mid ,
108
131
short = short ,
109
132
cap = cap ,
110
133
minor.ticks = TRUE ,
111
- short_theme = short_theme ,
134
+ short_theme = short.theme ,
112
135
theme = theme ,
113
136
... ,
114
137
super = GuideAxisLogticks
@@ -152,7 +175,7 @@ GuideAxisLogticks <- ggproto(
152
175
trans_name <- scale $ get_transformation()$ name
153
176
if (trans_name != " identity" ) {
154
177
cli :: cli_warn(paste0(
155
- " The {.arg prescale_base } argument will override the scale's " ,
178
+ " The {.arg prescale.base } argument will override the scale's " ,
156
179
" {.field {trans_name}} transformation in log-tick positioning."
157
180
))
158
181
}
0 commit comments