Learn R Programming

cairoDevice (version 2.28.2.1)

Cairo: The Cairo Graphics Device

Description

Open an R graphics device based on the Cairo vector graphics library

Usage

Cairo(width = 7, height = 7, pointsize = 12,
        surface = c("screen", "png", "pdf", "ps", "svg"), filename = NULL)
  Cairo_pdf(filename, width = 7, height = 7, pointsize = 12)
  Cairo_ps(filename, width = 7, height = 7, pointsize = 12)
  Cairo_svg(filename, width = 7, height = 7, pointsize = 12)
  Cairo_png(filename, width = 7, height = 7, pointsize = 12)

Arguments

width

The (initial) width in inches

height

The (initial) height in inches

pointsize

The pointsize of the font

surface

One of screen, pdf, ps, svg, or png, indicating the cairo backend to use (the output format). If missing, inferred from extension of the filename argument.

filename

The output filename (used only by file surfaces, not the screen). If a file surface is specified but no filename is given, the filename defaults to Rplots.SURFACE where SURFACE is the name of the current surface type.

Details

Creates an R graphics device that draws to the specified Cairo surface. By default, this will draw to a GTK+ window on the screen, but it also outputs to pdf, ps, png, and svg files, depending on the capabilities of your cairo installation.

This functions the same as any other R graphics device. You may use the conventional plot commands and expect essentially the same output, except that everything is anti-aliased (similar to other vector-based devices like Quartz). Alpha-blending is supported, as is enhanced interactivity via getGraphicsEvent. The device should work the same across all supported platforms (Mac, Windows, and Linux).

References

http://www.cairographics.org/

See Also

asCairoDevice for embedding the device in an RGtk2 interface.

Examples

Run this code
# NOT RUN {
Cairo()
plot(1:10)
dev.off()
# }

Run the code above in your browser using DataLab