私はお互いの下にいくつかのプロットを配置する必要があり、マージンとFigure領域の幅をきちんと整列させたいと思います。私は2つの単一プロットが必要であり、1つのプロットプロットは必要ないことに注意してください。私は別々のPNGファイルにそれぞれを保存したい。私はちょうどそれらの構造(マージン、図の領域のサイズ)を同一にしたい。ggplot2のマージン/フィギュア領域の幅を整列/設定する
library(ggplot2)
d <- data.frame(label=c("some very longe label with lots of text",
"another long label with lots of text",
"short",
"also short",
" short",
" also short"),
x = 1:6)
ggplot(d[1:2, ], aes(label, x)) + geom_bar(stat = "identity") + coord_flip()
ggplot(d[3:4, ], aes(label, x)) + geom_bar(stat = "identity") + coord_flip()
私が欲しいのは、余分な空白を追加することなく、当然のことながら、多かれ少なかれ以下のように、プロット1と同じ左マージン幅を持っているプロット2である。)
ベースグラフィックでは、それに応じてpar("mar")
を設定します。
これをggplotでどうすれば達成できますか?
このコメントhttp://stackoverflow.com/questions/41230345/ggplot2-change-plot-areas-for-same-size-にあるリンクを参照してください。プロット - インマルチプロット#comment69662588_41230345 – user20650
https://github.com/baptiste/egg#setting-panel-size – baptiste