0

いくつかのプロットを EPS ファイルにエクスポートしています。私のコードは

setEPS()
postscript("test.eps")
par(mar=c(0,0,0,0))
plot(1:10)
dev.off()

しかし、プロット領域の周りに (デバイス) マージンがあることがわかりました。それらを削除するには?ありがとうございました。

4

1 に答える 1

2

それはマージンではありません。コードによって生成された EPS には、軸、目盛り、またはプロット フレームがないことに注意してください。これらを描画する余地はなく、プロット フレームは EPS の端に正確に配置されます。

表示されているのは、R が軸の制限に追加する追加のパディングであり、プロット文字がプロット領域の端ではなく、プロット領域内にあることを確認します。IIRC このパディングは 4% です。

これをオフにするには、x 軸と y 軸にそれぞれxaxsおよびplotting パラメータを使用します。yaxs見る?par

 ‘xaxs’ The style of axis interval calculation to be used for the
      x-axis.  Possible values are ‘"r"’, ‘"i"’, ‘"e"’, ‘"s"’,
      ‘"d"’.  The styles are generally controlled by the range of
      data or ‘xlim’, if given.
      Style ‘"r"’ (regular) first extends the data range by 4
      percent at each end and then finds an axis with pretty labels
      that fits within the extended range.
      Style ‘"i"’ (internal) just finds an axis with pretty labels
      that fits within the original data range.
      ** editted for brevity **
      (_Only ‘"r"’ and ‘"i"’ styles have been implemented in R._)

デフォルトは です"r"。代わりに次を使用します。

setEPS()
postscript("test.eps")
par(mar=c(0,0,0,0), xaxs = "i", yaxs = "i")
plot(1:10)
dev.off()
于 2012-12-11T18:04:23.587 に答える