savepng {arrayMagic} | R Documentation

## Save the contents of the current graphics device to a PDF or PNG file

### Description

Save the contents of the current graphics device to a PDF or PNG file

### Usage

      savepng(fn, dir, width=480, asp=1)
      savepdf(fn, dir, width=6, asp=1)

### Arguments

`fn` | character: name of the output file (without extension .png or .pdf)
`dir` | character: directory to which the file should be written. If `NULL`, use the filename in `fn` only.
`width` | numeric: width of the image in pixels (png) or inches (pdf)
`asp` | numeric: aspect ratio; height=width*asp

### Details

### Value

Character: name of the written file.

### Author(s)

Wolfgang Huber http://www.dkfz.de/mga/whuber

### See Also

`dev.copy`,`pdf`,`png`

### Examples

      x = seq(0, 20*pi, len=1000)
      plot(x*sin(x), x*cos(x), type="l")

      try({   ## on some machines, png or pdf may not be available
      savepdf("spiral", dir=tempdir())
      ## Not run:
      savepng("spiral", dir=tempdir())

    ## End(Not run)
      })

[Package Contents]