したがって、セットアップは次のようになります。
dat <- data.frame(a = c("longnameonthelefthandside"), b = c(sample(10)))
p <- ggplot(dat, aes(b,a)) + geom_point() + xlab("label")
unit
オブジェクトをhjust
次の場所に渡すことで、x軸のラベルを調整できます。
p + opts(axis.title.x=theme_text(size=12,hjust=unit(0.3,"npc")))
しかし、私が把握していないユニットオブジェクト(?unitによると可能性があります)を追加することについて何かがあります:
u1 <- unit(0.5,"npc")
u2 <- unit(0.25,"npc")
p + opts(axis.title.x=theme_text(size=12,hjust=u1+u2))
次のエラーが発生します。
Error in grid.Call("L_textBounds", as.graphicsAnnot(x$label), x$x, x$y, :
Polygon edge not found
In addition: Warning message:
In validDetails.text(x) : NAs introduced by coercion
さらなる文脈として、私はここでバプティストを介してやや不可解な回避策をつなぎ合わせようとしています