@@ -359,14 +359,36 @@ CoordRadial <- ggproto("CoordRadial", Coord,
359
359
if (! isFALSE(self $ r_axis_inside )) {
360
360
return (list (left = zeroGrob(), right = zeroGrob()))
361
361
}
362
- CoordCartesian $ render_axis_v(panel_params , theme )
362
+ axis <- CoordCartesian $ render_axis_v(panel_params , theme )
363
+
364
+ # align the axis with the panel area
365
+ panel_margin <- panel_params $ panel_margin
366
+ vp <- viewport(height = unit(1 , " npc" ) - panel_margin * 2L )
367
+ lapply(axis , function (g ) {
368
+ if (is.null(g $ vp )) {
369
+ editGrob(g , vp = vp )
370
+ } else {
371
+ editGrob(g , vp = vpStack(vp , g $ vp ))
372
+ }
373
+ })
363
374
},
364
375
365
376
render_axis_h = function (self , panel_params , theme ) {
366
377
if (! isFALSE(self $ r_axis_inside )) {
367
378
return (list (top = zeroGrob(), bottom = zeroGrob()))
368
379
}
369
- CoordCartesian $ render_axis_h(panel_params , theme )
380
+ axis <- CoordCartesian $ render_axis_h(panel_params , theme )
381
+
382
+ # align the axis with the panel area
383
+ panel_margin <- panel_params $ panel_margin
384
+ vp <- viewport(width = unit(1 , " npc" ) - panel_margin * 2L )
385
+ lapply(axis , function (g ) {
386
+ if (is.null(g $ vp )) {
387
+ editGrob(g , vp = vp )
388
+ } else {
389
+ editGrob(g , vp = vpStack(vp , g $ vp ))
390
+ }
391
+ })
370
392
},
371
393
372
394
render_bg = function (self , panel_params , theme ) {
0 commit comments