21
21
# ' using `scale_y_log10()`. It should be `FALSE` when using
22
22
# ' `coord_trans(y = "log10")`.
23
23
# ' @param colour Colour of the tick marks.
24
- # ' @param size Thickness of tick marks, in mm.
24
+ # ' @param linewidth Thickness of tick marks, in mm.
25
25
# ' @param linetype Linetype of tick marks (`solid`, `dashed`, etc.)
26
26
# ' @param alpha The transparency of the tick marks.
27
27
# ' @param color An alias for `colour`.
28
28
# ' @param ... Other parameters passed on to the layer
29
+ # ' @param size `r lifecycle::badge("deprecated")`
29
30
# '
30
31
# ' @export
31
32
# ' @seealso [scale_y_continuous()], [scale_y_log10()] for log scale
81
82
# ' )
82
83
annotation_logticks <- function (base = 10 , sides = " bl" , outside = FALSE , scaled = TRUE ,
83
84
short = unit(0.1 , " cm" ), mid = unit(0.2 , " cm" ), long = unit(0.3 , " cm" ),
84
- colour = " black" , size = 0.5 , linetype = 1 , alpha = 1 , color = NULL , ... )
85
+ colour = " black" , linewidth = 0.5 , linetype = 1 , alpha = 1 , color = NULL , ... ,
86
+ size = deprecated())
85
87
{
86
88
if (! is.null(color ))
87
89
colour <- color
88
90
91
+ if (lifecycle :: is_present(size )) {
92
+ deprecate_soft0(" 3.5.0" , I(" Using the `size` aesthetic in this geom" ), I(" `linewidth`" ))
93
+ linewidth <- linewidth %|| % size
94
+ }
95
+
89
96
layer(
90
97
data = dummy_data(),
91
98
mapping = NULL ,
@@ -103,7 +110,7 @@ annotation_logticks <- function(base = 10, sides = "bl", outside = FALSE, scaled
103
110
mid = mid ,
104
111
long = long ,
105
112
colour = colour ,
106
- size = size ,
113
+ linewidth = linewidth ,
107
114
linetype = linetype ,
108
115
alpha = alpha ,
109
116
...
@@ -163,14 +170,14 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,
163
170
ticks $ x_b <- with(data , segmentsGrob(
164
171
x0 = unit(xticks $ x , " native" ), x1 = unit(xticks $ x , " native" ),
165
172
y0 = unit(xticks $ start , " cm" ), y1 = unit(xticks $ end , " cm" ),
166
- gp = gpar(col = alpha(colour , alpha ), lty = linetype , lwd = size * .pt )
173
+ gp = gpar(col = alpha(colour , alpha ), lty = linetype , lwd = linewidth * .pt )
167
174
))
168
175
}
169
176
if (grepl(" t" , sides ) && nrow(xticks ) > 0 ) {
170
177
ticks $ x_t <- with(data , segmentsGrob(
171
178
x0 = unit(xticks $ x , " native" ), x1 = unit(xticks $ x , " native" ),
172
179
y0 = unit(1 , " npc" ) - unit(xticks $ start , " cm" ), y1 = unit(1 , " npc" ) - unit(xticks $ end , " cm" ),
173
- gp = gpar(col = alpha(colour , alpha ), lty = linetype , lwd = size * .pt )
180
+ gp = gpar(col = alpha(colour , alpha ), lty = linetype , lwd = linewidth * .pt )
174
181
))
175
182
}
176
183
}
@@ -201,22 +208,22 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,
201
208
ticks $ y_l <- with(data , segmentsGrob(
202
209
y0 = unit(yticks $ y , " native" ), y1 = unit(yticks $ y , " native" ),
203
210
x0 = unit(yticks $ start , " cm" ), x1 = unit(yticks $ end , " cm" ),
204
- gp = gpar(col = alpha(colour , alpha ), lty = linetype , lwd = size * .pt )
211
+ gp = gpar(col = alpha(colour , alpha ), lty = linetype , lwd = linewidth * .pt )
205
212
))
206
213
}
207
214
if (grepl(" r" , sides ) && nrow(yticks ) > 0 ) {
208
215
ticks $ y_r <- with(data , segmentsGrob(
209
216
y0 = unit(yticks $ y , " native" ), y1 = unit(yticks $ y , " native" ),
210
217
x0 = unit(1 , " npc" ) - unit(yticks $ start , " cm" ), x1 = unit(1 , " npc" ) - unit(yticks $ end , " cm" ),
211
- gp = gpar(col = alpha(colour , alpha ), lty = linetype , lwd = size * .pt )
218
+ gp = gpar(col = alpha(colour , alpha ), lty = linetype , lwd = linewidth * .pt )
212
219
))
213
220
}
214
221
}
215
222
216
223
gTree(children = inject(gList(!!! ticks )))
217
224
},
218
225
219
- default_aes = aes(colour = " black" , size = 0.5 , linetype = 1 , alpha = 1 )
226
+ default_aes = aes(colour = " black" , linewidth = 0.5 , linetype = 1 , alpha = 1 )
220
227
)
221
228
222
229
0 commit comments