@@ -199,13 +199,28 @@ ggplot_gtable.ggplot_built <- function(data) {
199
199
ypos <- theme $ legend.position [2 ]
200
200
201
201
# x and y are specified via theme$legend.position (i.e., coords)
202
- legend_box <- editGrob(legend_box ,
203
- vp = viewport(x = xpos , y = ypos , just = c(xjust , yjust ),
204
- height = legend_height , width = legend_width ))
202
+ legend_box <- editGrob(
203
+ legend_box ,
204
+ vp = viewport(
205
+ x = xpos ,
206
+ y = ypos ,
207
+ just = c(xjust , yjust ),
208
+ height = legend_height ,
209
+ width = legend_width
210
+ )
211
+ )
205
212
} else {
206
213
# x and y are adjusted using justification of legend box (i.e., theme$legend.justification)
207
- legend_box <- editGrob(legend_box ,
208
- vp = viewport(x = xjust , y = yjust , just = c(xjust , yjust )))
214
+ legend_box <- editGrob(
215
+ legend_box ,
216
+ vp = viewport(
217
+ x = xjust ,
218
+ y = yjust ,
219
+ just = c(xjust , yjust ),
220
+ height = legend_height ,
221
+ width = legend_width
222
+ )
223
+ )
209
224
legend_box <- gtable_add_rows(legend_box , unit(yjust , ' null' ))
210
225
legend_box <- gtable_add_rows(legend_box , unit(1 - yjust , ' null' ), 0 )
211
226
legend_box <- gtable_add_cols(legend_box , unit(xjust , ' null' ), 0 )
0 commit comments