bitmap
generates a graphics file.
dev2bitmap
copies the current graphics device to a file in a
graphics format.
bitmap(file, type = "png16m", height = 7, width = 7, res = 72, units = "in", pointsize, taa = NA, gaa = NA, ...)
dev2bitmap(file, type = "png16m", height = 7, width = 7, res = 72, units = "in", pointsize, ..., method = c("postscript", "pdf"), taa = NA, gaa = NA)
height
and width
are
given. Can be in
(inches), px
(pixels), cm
or
mm
.postscript
or
pdf
.postscript
or
pdf
?res
: dev2bitmap
works by copying the current device to a
postscript
or pdf
device, and
post-processing the output file using ghostscript
.
bitmap
works in the same way using a postscript
device
and post-processing the output as printing. You will need ghostscript
: the full path to the executable can
be set by the environment variable R_GSCMD. If this is unset, a
GhostScript executable will be looked for by name on your path: on a
Unix alike "gs"
is used, and on Windows the setting of the
environment variable GSC is used, otherwise commands
"gswi64c.exe"
then "gswin32c.exe"
are tried.
The types available will depend on the version of ghostscript
,
but are likely to include
"jpeg"
, "jpegcmyk"
, "jpeggray"
,
"tiffcrle"
, "tiffg3"
,
"tiffg32d"
, "tiffg4"
, "tiffgray"
, "tifflzw"
,
"tiffpack"
, "tiff12nc"
, "tiff24nc"
, "tiff32nc"
"png16"
, "png16m"
, "png256"
, "png48"
,
"pngmono"
, "pnggray"
, "pngalpha"
,
"bmp16"
, "bmp16m"
"bmp256"
, "bmp32b"
,
"bmpgray"
, "bmpmono"
.
The default type, "png16m"
, supports 24-bit colour and
anti-aliasing. Type "png256"
uses a palette of 256 colours and
could give a more compact representation. Monochrome graphs can use
"pngmono"
, or "pnggray"
if anti-aliasing is desired.
Plots with a transparent background and varying degrees of
transparency should use "pngalpha"
.
Note that for a colour TIFF image you probably want "tiff24nc"
,
which is 8-bit per channel RGB (the most common TIFF format). None of
the listed TIFF types support transparency. "tiff32nc"
uses
8-bit per channel CMYK, which printers might require.
For formats which contain a single image, a file specification like
Rplots%03d.png
can be used: this is interpreted by Ghostscript.
For dev2bitmap
if just one of width
and height
is
specified, the other is chosen to preserve the aspect ratio of the
device being copied. The main reason to prefer method = "pdf"
over the default would be to allow semi-transparent colours to be used.
For graphics parameters such as "cra"
that need to work in
pixels, the default resolution of 72dpi is always used.
windows
Paths for file
and R_GSCMD which contain spaces are
mapped to short names via shortPathName
.
savePlot
, which for windows
and
X11(type = "cairo")
provides a simple way to record a PNG
record of the current plot. postscript
, pdf
, png
,
jpeg
, tiff
and bmp
.
To display an array of data, see image
.