Cairo initializes a new graphics device that uses the Cairo
graphics library for rendering. The current implementation produces
high-quality PNG, JPEG, TIFF bitmap files, high resolution PDF files
with embedded fonts, SVG graphics and PostScript files. It also
provides X11 and Windows interactive graphics devices. Unlike other
devices it supports all graphics features including alpha blending,
anti-aliasing etc. CairoX11, CairoPNG, CairoPDF, CairoPS and
CairoSVG are convenience wrappers of Cairo that take the
same arguments as the corresponding device it replaces such as
X11, png, pdf, etc.
Cairo(width = 640, height = 480, file="", type="png", pointsize=12,
bg = "transparent", canvas = "white", units = "px", dpi = "auto",
...)CairoX11(display=Sys.getenv("DISPLAY"), width = 7, height = 7,
pointsize = 12, gamma = getOption("gamma"), bg = "transparent",
canvas = "white", xpos = NA, ypos = NA)
CairoPNG(filename = "Rplot%03d.png", width = 480, height = 480,
pointsize = 12, bg = "white", res = NA, ...)
CairoJPEG(filename = "Rplot%03d.jpeg", width = 480, height = 480,
pointsize = 12, quality = 75, bg = "white", res = NA, ...)
CairoTIFF(filename = "Rplot%03d.tiff", width = 480, height = 480,
pointsize = 12, bg = "white", res = NA, ...)
CairoPDF(file = ifelse(onefile, "Rplots.pdf","Rplot%03d.pdf"),
width = 6, height = 6, onefile = TRUE, family = "Helvetica",
title = "R Graphics Output", fonts = NULL, version = "1.1",
paper = "special", encoding, bg, fg, pointsize, pagecentre)
CairoWin(width = 7, height = 7, pointsize = 12,
record = getOption("graphics.record"),
rescale = c("R", "fit", "fixed"), xpinch, ypinch, bg =
"transparent", canvas = "white", gamma = getOption("gamma"),
xpos = NA, ypos = NA, buffered = getOption("windowsBuffered"),
restoreConsole = FALSE)
CairoPS(file = ifelse(onefile, "Rplots.ps", "Rplot%03d.ps"),
onefile = TRUE, family, title = "R Graphics Output", fonts = NULL,
encoding, bg, fg, width, height, horizontal, pointsize, paper,
pagecentre, print.it, command, colormodel)
units).units).file specifies the display name. If NULL or
"" a reasonable default will be chose whwidth and height
specifications. In can be any of "px" (pixels),
"in" (inches), "pt" (points), "cm"
(centimeters) or "mm""auto" the DPI resolution will be determined by the
back-end.Cairo. They are described in detail in theX11X11X11file in Cairopng, will be mapped to dpi
for Cairojpegpdf). false is currently
not supported by vector devicespdfpdf (ignored)pdf, ignored, Cairo
automatically detects and embeds fontspdf (ignored)pdf (ignored, Cairo uses device dimensions)pdf (ignored, Cairo uses
native enconding except for symbols)pdf (ignored)pdf (ignored, Cairo
uses device dimensions and thus it is irrelevant)windows (ignored)widnows (ignored)windows (ignored)windows (ignored)windows (ignored, Cairo
always uses cache buffer)windows (ignored)postscript (ignored)postscript (ignored)postscript (ignored)postscript (ignored,
Cairo always uses RGB or ARGB)Cairo object if successful. The vaule of the object is the
device number.CairoFontsCairo(800, 600, file="plot.png", type="png")
plot(rnorm(100),rnorm(100),col=2)
dev.off() # creates a file "plot.png" with the above plotRun the code above in your browser using DataLab