@@ -159,14 +159,14 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,
159
159
xticks $ end = - xticks $ end
160
160
161
161
# Make the grobs
162
- if (grepl(" b" , sides )) {
162
+ if (grepl(" b" , sides ) && nrow( xticks ) > 0 ) {
163
163
ticks $ x_b <- with(data , segmentsGrob(
164
164
x0 = unit(xticks $ x , " native" ), x1 = unit(xticks $ x , " native" ),
165
165
y0 = unit(xticks $ start , " cm" ), y1 = unit(xticks $ end , " cm" ),
166
166
gp = gpar(col = alpha(colour , alpha ), lty = linetype , lwd = size * .pt )
167
167
))
168
168
}
169
- if (grepl(" t" , sides )) {
169
+ if (grepl(" t" , sides ) && nrow( xticks ) > 0 ) {
170
170
ticks $ x_t <- with(data , segmentsGrob(
171
171
x0 = unit(xticks $ x , " native" ), x1 = unit(xticks $ x , " native" ),
172
172
y0 = unit(1 , " npc" ) - unit(xticks $ start , " cm" ), y1 = unit(1 , " npc" ) - unit(xticks $ end , " cm" ),
@@ -197,14 +197,14 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,
197
197
yticks $ end = - yticks $ end
198
198
199
199
# Make the grobs
200
- if (grepl(" l" , sides )) {
200
+ if (grepl(" l" , sides ) && nrow( yticks ) > 0 ) {
201
201
ticks $ y_l <- with(data , segmentsGrob(
202
202
y0 = unit(yticks $ y , " native" ), y1 = unit(yticks $ y , " native" ),
203
203
x0 = unit(yticks $ start , " cm" ), x1 = unit(yticks $ end , " cm" ),
204
204
gp = gpar(col = alpha(colour , alpha ), lty = linetype , lwd = size * .pt )
205
205
))
206
206
}
207
- if (grepl(" r" , sides )) {
207
+ if (grepl(" r" , sides ) && nrow( yticks ) > 0 ) {
208
208
ticks $ y_r <- with(data , segmentsGrob(
209
209
y0 = unit(yticks $ y , " native" ), y1 = unit(yticks $ y , " native" ),
210
210
x0 = unit(1 , " npc" ) - unit(yticks $ start , " cm" ), x1 = unit(1 , " npc" ) - unit(yticks $ end , " cm" ),
0 commit comments