2121# ' using `scale_y_log10()`. It should be `FALSE` when using
2222# ' `coord_trans(y = "log10")`.
2323# ' @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.
2525# ' @param linetype Linetype of tick marks (`solid`, `dashed`, etc.)
2626# ' @param alpha The transparency of the tick marks.
2727# ' @param color An alias for `colour`.
2828# ' @param ... Other parameters passed on to the layer
29+ # ' @param size `r lifecycle::badge("deprecated")`
2930# '
3031# ' @export
3132# ' @seealso [scale_y_continuous()], [scale_y_log10()] for log scale
8182# ' )
8283annotation_logticks <- function (base = 10 , sides = " bl" , outside = FALSE , scaled = TRUE ,
8384 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())
8587{
8688 if (! is.null(color ))
8789 colour <- color
8890
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+
8996 layer(
9097 data = dummy_data(),
9198 mapping = NULL ,
@@ -103,7 +110,7 @@ annotation_logticks <- function(base = 10, sides = "bl", outside = FALSE, scaled
103110 mid = mid ,
104111 long = long ,
105112 colour = colour ,
106- size = size ,
113+ linewidth = linewidth ,
107114 linetype = linetype ,
108115 alpha = alpha ,
109116 ...
@@ -163,14 +170,14 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,
163170 ticks $ x_b <- with(data , segmentsGrob(
164171 x0 = unit(xticks $ x , " native" ), x1 = unit(xticks $ x , " native" ),
165172 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 )
167174 ))
168175 }
169176 if (grepl(" t" , sides ) && nrow(xticks ) > 0 ) {
170177 ticks $ x_t <- with(data , segmentsGrob(
171178 x0 = unit(xticks $ x , " native" ), x1 = unit(xticks $ x , " native" ),
172179 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 )
174181 ))
175182 }
176183 }
@@ -201,22 +208,22 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,
201208 ticks $ y_l <- with(data , segmentsGrob(
202209 y0 = unit(yticks $ y , " native" ), y1 = unit(yticks $ y , " native" ),
203210 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 )
205212 ))
206213 }
207214 if (grepl(" r" , sides ) && nrow(yticks ) > 0 ) {
208215 ticks $ y_r <- with(data , segmentsGrob(
209216 y0 = unit(yticks $ y , " native" ), y1 = unit(yticks $ y , " native" ),
210217 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 )
212219 ))
213220 }
214221 }
215222
216223 gTree(children = inject(gList(!!! ticks )))
217224 },
218225
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 )
220227)
221228
222229
0 commit comments