bmp(filename = "Rplot%03d.bmp",
width = 480, height = 480, units = "px", pointsize = 12,
bg = "white", res = NA, family = "", restoreConsole = TRUE,
type = c("windows", "cairo"), antialias)jpeg(filename = "Rplot%03d.jpg",
width = 480, height = 480, units = "px", pointsize = 12,
quality = 75,
bg = "white", res = NA, family = "", restoreConsole = TRUE,
type = c("windows", "cairo"), antialias)
png(filename = "Rplot%03d.png",
width = 480, height = 480, units = "px", pointsize = 12,
bg = "white", res = NA, family = "", restoreConsole = TRUE,
type = c("windows", "cairo", "cairo-png"), antialias)
tiff(filename = "Rplot%03d.tif",
width = 480, height = 480, units = "px", pointsize = 12,
compression = c("none", "rle", "lzw", "jpeg", "zip", "lzw+p", "zip+p"),
bg = "white", res = NA, family = "", restoreConsole = TRUE,
type = c("windows", "cairo"), antialias)
path.expand
). (The result must be less than
600 characters long. See postscript
for further
details.)
height
and width
are
given. Can be px
(pixels, the default), in
(inches),
cm
or mm
.res
ppi."sans"
on the cairographics
versions.windows
. For type == "windows"
only. For allowed values and their effect on fonts with type =
"windows"
see windows
: for that type if the
argument is missing the default is taken from
windows.options()$bitmap.aa.win
.
For allowed values and their effect (on fonts and lines, but not
fills) with type = "cairo"
see svg
.
width
and height
values are in
pixels not inches. A warning will be issued if both are less than 20. If you plot more than one page on one of these devices and do not
include something like %d
for the sequence number in
file
, the file will contain the last page plotted.fontconfig
to support a wide range of
font formats.
.jpg
and .tif
on Windows, and
.jpeg
and .tiff
elsewhere.res
ppi.
res
ppi), with a minimum of one pixel (type =
"windows"
) or 0.01 (type = "cairo"
).
type =
"windows"
.
tiff
is lossless and stores RGB values
uncompressed---such files are widely accepted, which is their main
virtue over PNG. Windows GDI imposes limits on the size of bitmaps: these are not
documented in the SDK and may depend on the version of Windows.
It seems that width
and height
are each limited to
\(2^{15}-1\). In addition, there are limits on the total
number of pixels which depend on the graphics hardware. By default no resolution is recorded in the file (except for BMP).
Viewers will often assume a nominal resolution of 72 ppi when none is
recorded. As resolutions in PNG files are recorded in pixels/metre,
the reported ppi value will be changed slightly. For graphics parameters that make use of dimensions in inches,
res
ppi (default 72) is assumed. Both bmp
and png
will use a palette if there are fewer
than 256 colours on the page, and record a 24-bit RGB file otherwise.
For the png
device, type = "cairo"
does the PNG output in
the driver and so is compatible with the "windows"
type.
type = "cairo-png"
uses cairographics' PNG backend which will
never use a palette and normally creates a larger 32-bit ARGB
file---this may work better for specialist uses with semi-transparent
colours. png(type = "windows")
supports transparent backgrounds on 16-bit
(‘High Color’) or better screens: use bg =
"transparent"
. There is also support for semi-transparent colours
of lines, fills and text. However, as there is only partial support
for transparency in the graphics toolkit used: if there is a
transparent background semi-transparent colours are painted onto a
slightly off-white background and hence the pixels are opaque. Not all PNG viewers render files with transparency correctly. tiff
compression types "lzw+p"
and "zip+p"
use
horizontal differencing (‘differencing predictor’, section 14
of the TIFF specification) in combination with the compression method,
which is effective for continuous-tone images, especially colour ones. Unknown resolutions in BMP files are recorded as 72 ppi.Devices
, dev.print
bitmap
provides an alternative way to generate plots in
many bitmap formats if GhostScript is available.## copy current plot to a (large) PNG file
## Not run: ------------------------------------
# dev.print(png, file = "myplot.png", width = 1024, height = 768)
#
# png(file = "myplot.png", bg = "transparent")
# plot(1:10)
# rect(1, 5, 3, 7, col = "white")
# dev.off()
#
# jpeg(file = "myplot.jpeg")
# example(rect)
# dev.off()
## ---------------------------------------------
Run the code above in your browser using DataLab