Re: [R] 'Extracting' plot area

From: Marc Schwartz <>
Date: Wed, 21 May 2008 08:56:21 -0500

on 05/21/2008 08:02 AM Tine wrote:
> Hi!
> Does anyone know hot to save (to png, pdf, ...) only plot area. That is
> without box around, titles, axis, ...
> I tried: par(mar=c(0,0,0,0)) and it works for internal viewer (linux and
> windows).
> But when I save the image in png it adds that annoying margin around
> plot area.
> Any ideas?
> by, Tine

Is this what you want?

   pdf("plot.pdf", height = 4, width = 4)    par(mar = c(0, 0, 0, 0))
   plot(1:10, ann = FALSE, axes = FALSE)

See ?plot.default for more information on the 'ann' and 'axes' arguments.

HTH, Marc Schwartz mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 21 May 2008 - 13:59:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 21 May 2008 - 14:30:39 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive