EVOLUTION-MANAGER
Edit File: cairo.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Cairographics-based SVG, PDF and PostScript Graphics Devices</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for cairo {grDevices}"><tr><td>cairo {grDevices}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Cairographics-based SVG, PDF and PostScript Graphics Devices</h2> <h3>Description</h3> <p>Graphics devices for SVG, PDF and PostScript graphics files using the cairo graphics API. </p> <h3>Usage</h3> <pre> svg(filename = if(onefile) "Rplots.svg" else "Rplot%03d.svg", width = 7, height = 7, pointsize = 12, onefile = FALSE, family = "sans", bg = "white", antialias = c("default", "none", "gray", "subpixel")) cairo_pdf(filename = if(onefile) "Rplots.pdf" else "Rplot%03d.pdf", width = 7, height = 7, pointsize = 12, onefile = FALSE, family = "sans", bg = "white", antialias = c("default", "none", "gray", "subpixel"), fallback_resolution = 300) cairo_ps(filename = if(onefile) "Rplots.ps" else "Rplot%03d.ps", width = 7, height = 7, pointsize = 12, onefile = FALSE, family = "sans", bg = "white", antialias = c("default", "none", "gray", "subpixel"), fallback_resolution = 300) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>filename</code></td> <td> <p>the name of the output file. The page number is substituted if a C integer format is included in the character string, as in the default. (The result must be less than <code>PATH_MAX</code> characters long, and may be truncated if not. See <code><a href="postscript.html">postscript</a></code> for further details.) Tilde expansion is performed where supported by the platform.</p> </td></tr> <tr valign="top"><td><code>width</code></td> <td> <p>the width of the device in inches.</p> </td></tr> <tr valign="top"><td><code>height</code></td> <td> <p>the height of the device in inches.</p> </td></tr> <tr valign="top"><td><code>pointsize</code></td> <td> <p>the default pointsize of plotted text (in big points).</p> </td></tr> <tr valign="top"><td><code>onefile</code></td> <td> <p>should all plots appear in one file or in separate files?</p> </td></tr> <tr valign="top"><td><code>family</code></td> <td> <p>one of the device-independent font families, <code>"sans"</code>, <code>"serif"</code> and <code>"mono"</code>, or a character string specify a font family to be searched for in a system-dependent way. </p> <p>On unix-alikes (incl.\ Mac), see the ‘Cairo fonts’ section in the help for <code><a href="x11.html">X11</a></code>. </p> </td></tr> <tr valign="top"><td><code>bg</code></td> <td> <p>the initial background colour: can be overridden by setting par("bg").</p> </td></tr> <tr valign="top"><td><code>antialias</code></td> <td> <p>string, the type of anti-aliasing (if any) to be used; defaults to <code>"default"</code>.</p> </td></tr> <tr valign="top"><td><code>fallback_resolution</code></td> <td> <p>numeric: the resolution in dpi used when falling back to bitmap output. Prior to <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> 3.3.0 this depended on the cairo implementation but was commonly 300.</p> </td></tr> </table> <h3>Details</h3> <p>SVG (Scalar Vector Graphics) is a W3C standard for vector graphics. See <a href="http://www.w3.org/Graphics/SVG/">http://www.w3.org/Graphics/SVG/</a>. The output from <code>svg</code> is SVG version 1.1 for <code>onefile = FALSE</code> (the default), otherwise SVG 1.2. (Few SVG viewers are capable of displaying multi-page SVG files.) </p> <p>Note that unlike <code><a href="postscript.html">postscript</a></code> and <code><a href="pdf.html">pdf</a></code>, <code>cairo_pdf</code> and <code>cairo_ps</code> sometimes record <em>bitmaps</em> and not vector graphics. On the other hand, they can (on suitable platforms) include a much wider range of UTF-8 glyphs, and embed the fonts used. </p> <p>The output produced by <code>cairo_ps(onefile = FALSE)</code> will be encapsulated postscript on a platform with cairo >= 1.6. </p> <p><span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> can be compiled without support for any of these devices: this will be reported if you attempt to use them on a system where they are not supported. They all require cairo version 1.2 (from 2006) or later. </p> <p>If you plot more than one page on one of these devices and do not include something like <code>%d</code> for the sequence number in <code>file</code> (or set <code>onefile = TRUE</code>) the file will contain the last page plotted. </p> <p>There is full support of semi-transparency, but using this is one of the things liable to trigger bitmap output (and will always do so for <code>cairo_ps</code>). </p> <h3>Value</h3> <p>A plot device is opened: nothing is returned to the <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> interpreter. </p> <h3>Anti-aliasing</h3> <p>Anti-aliasing is applied to both graphics and fonts. It is generally preferable for lines and text, but can lead to undesirable effects for fills, e.g. for <code><a href="../../graphics/html/image.html">image</a></code> plots, and so is never used for fills. </p> <p><code>antialias = "default"</code> is in principle platform-dependent, but seems most often equivalent to <code>antialias = "gray"</code>. </p> <h3>Conventions</h3> <p>This section describes the implementation of the conventions for graphics devices set out in the “R Internals Manual”. </p> <ul> <li><p> The default device size is in pixels (<code>svg</code>) or inches. </p> </li> <li><p> Font sizes are in big points. </p> </li> <li><p> The default font family is Helvetica. </p> </li> <li><p> Line widths are multiples of 1/96 inch. </p> </li> <li><p> Circle radii have a minimum of 1/72 inch. </p> </li> <li><p> Colours are interpreted by the viewing application. </p> </li></ul> <h3>Note</h3> <p>Cairo 1.2.4 (seen in Centos/RHEL 5) is known to give incorrect SVG output. </p> <p>In principle these devices are independent of X11 (as is seen by their presence on Windows). But on a Unix-alike the cairo libraries may be distributed as part of the X11 system and hence that (on macOS, XQuartz) may need to be installed. </p> <h3>See Also</h3> <p><code><a href="Devices.html">Devices</a></code>, <code><a href="dev2.html">dev.print</a></code>, <code><a href="pdf.html">pdf</a></code>, <code><a href="postscript.html">postscript</a></code> </p> <p><code><a href="../../base/html/capabilities.html">capabilities</a></code> to see if cairo is supported. </p> <hr /><div style="text-align: center;">[Package <em>grDevices</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>