1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/devices.R
\name{devices}
\alias{devices}
\alias{with_dev}
\alias{with_device}
\alias{with_bmp}
\alias{local_bmp}
\alias{with_cairo_pdf}
\alias{local_cairo_pdf}
\alias{with_cairo_ps}
\alias{local_cairo_ps}
\alias{with_pdf}
\alias{local_pdf}
\alias{with_postscript}
\alias{local_postscript}
\alias{with_svg}
\alias{local_svg}
\alias{with_tiff}
\alias{local_tiff}
\alias{with_xfig}
\alias{local_xfig}
\alias{with_png}
\alias{local_png}
\alias{with_jpeg}
\alias{local_jpeg}
\title{Graphics devices}
\usage{
with_bmp(new, code, ...)
local_bmp(new = list(), ..., .local_envir = parent.frame())
with_cairo_pdf(new, code, ...)
local_cairo_pdf(new = list(), ..., .local_envir = parent.frame())
with_cairo_ps(new, code, ...)
local_cairo_ps(new = list(), ..., .local_envir = parent.frame())
with_pdf(
new,
code,
width,
height,
onefile,
family,
title,
fonts,
version,
paper,
encoding,
bg,
fg,
pointsize,
pagecentre,
colormodel,
useDingbats,
useKerning,
fillOddEven,
compress
)
local_pdf(
new = list(),
width,
height,
onefile,
family,
title,
fonts,
version,
paper,
encoding,
bg,
fg,
pointsize,
pagecentre,
colormodel,
useDingbats,
useKerning,
fillOddEven,
compress,
.local_envir = parent.frame()
)
with_postscript(
new,
code,
onefile,
family,
title,
fonts,
encoding,
bg,
fg,
width,
height,
horizontal,
pointsize,
paper,
pagecentre,
print.it,
command,
colormodel,
useKerning,
fillOddEven
)
local_postscript(
new = list(),
onefile,
family,
title,
fonts,
encoding,
bg,
fg,
width,
height,
horizontal,
pointsize,
paper,
pagecentre,
print.it,
command,
colormodel,
useKerning,
fillOddEven,
.local_envir = parent.frame()
)
with_svg(
new,
code,
width = 7,
height = 7,
pointsize = 12,
onefile = FALSE,
family = "sans",
bg = "white",
antialias = c("default", "none", "gray", "subpixel"),
...
)
local_svg(
new = list(),
width = 7,
height = 7,
pointsize = 12,
onefile = FALSE,
family = "sans",
bg = "white",
antialias = c("default", "none", "gray", "subpixel"),
...,
.local_envir = parent.frame()
)
with_tiff(new, code, ...)
local_tiff(new = list(), ..., .local_envir = parent.frame())
with_xfig(
new,
code,
onefile = FALSE,
encoding = "none",
paper = "default",
horizontal = TRUE,
width = 0,
height = 0,
family = "Helvetica",
pointsize = 12,
bg = "transparent",
fg = "black",
pagecentre = TRUE,
defaultfont = FALSE,
textspecial = FALSE
)
local_xfig(
new = list(),
onefile = FALSE,
encoding = "none",
paper = "default",
horizontal = TRUE,
width = 0,
height = 0,
family = "Helvetica",
pointsize = 12,
bg = "transparent",
fg = "black",
pagecentre = TRUE,
defaultfont = FALSE,
textspecial = FALSE,
.local_envir = parent.frame()
)
with_png(new, code, ...)
local_png(new = list(), ..., .local_envir = parent.frame())
with_jpeg(new, code, ...)
local_jpeg(new = list(), ..., .local_envir = parent.frame())
}
\arguments{
\item{new}{\code{[named character]}\cr New graphics device}
\item{code}{\code{[any]}\cr Code to execute in the temporary environment}
\item{...}{Additional arguments passed to the graphics device.}
\item{.local_envir}{\verb{[environment]}\cr The environment to use for scoping.}
\item{width}{the width of the device in inches.}
\item{height}{the height of the device in inches.}
\item{onefile}{should all plots appear in one file or in separate files?}
\item{family}{one of the device-independent font families,
\code{"sans"}, \code{"serif"} and \code{"mono"}, or a character
string specify a font family to be searched for in a
system-dependent way.
On unix-alikes (incl.\\ Mac), see
the \sQuote{Cairo fonts} section in the help for \code{\link[grDevices]{X11}}.
}
\item{title}{title string to embed as the \samp{/Title} field in the
file. Defaults to \code{"R Graphics Output"}.}
\item{fonts}{a character vector specifying \R graphics font family
names for additional fonts which will be included in the PDF file.
Defaults to \code{NULL}.}
\item{version}{a string describing the PDF version that will be
required to view the output. This is a minimum, and will be
increased (with a warning) if necessary. Defaults to \code{"1.4"},
but see \sQuote{Details}.}
\item{paper}{the target paper size. The choices are
\code{"a4"}, \code{"letter"}, \code{"legal"} (or \code{"us"}) and
\code{"executive"} (and these can be capitalized), or \code{"a4r"}
and \code{"USr"} for rotated (\sQuote{landscape}).
The default is \code{"special"}, which means that the \code{width}
and \code{height} specify the paper size. A further choice is
\code{"default"}; if this is selected, the
papersize is taken from the option \code{"papersize"}
if that is set and as \code{"a4"} if it is unset or empty.
Defaults to \code{"special"}.
}
\item{encoding}{the name of an encoding file. See
\code{\link[grDevices]{postscript}} for details. Defaults to \code{"default"}.}
\item{bg}{the initial background colour: can be overridden by setting
par("bg").}
\item{fg}{the initial foreground color to be used. Defaults to
\code{"black"}.}
\item{pointsize}{the default pointsize of plotted text (in big points).}
\item{pagecentre}{logical: should the device region be centred on the
page? -- is only relevant for \code{paper != "special"}.
Defaults to \code{TRUE}.}
\item{colormodel}{a character string describing the color model:
currently allowed values are \code{"srgb"}, \code{"gray"} (or
\code{"grey"}) and \code{"cmyk"}. Defaults to \code{"srgb"}. See section
\sQuote{Color models}.}
\item{useDingbats}{logical. Should small circles be rendered
\emph{via} the Dingbats font? Defaults to \code{FALSE}.
If \code{TRUE}, this can produce smaller and better output, but
there can font display problems in broken PDF viewers: although this
font is one of the 14 guaranteed to be available in all PDF viewers,
that guarantee is not always honoured.
For Unix-alikes (including macOS) see the \sQuote{Note} for a
possible fix for some viewers.}
\item{useKerning}{logical. Should kerning corrections be included in
setting text and calculating string widths? Defaults to \code{TRUE}.}
\item{fillOddEven}{logical controlling the polygon fill mode: see
\code{\link{polygon}} for details. Defaults to \code{FALSE}.}
\item{compress}{logical. Should PDF streams be generated with Flate
compression? Defaults to \code{TRUE}.}
\item{horizontal}{the orientation of the printed image, a logical.
Defaults to true, that is landscape orientation on paper sizes
with width less than height.}
\item{print.it}{logical: should the file be printed when the device is
closed? (This only applies if \code{file} is a real file name.)
Defaults to false.}
\item{command}{the command to be used for \sQuote{printing}. Defaults
to \code{"default"}, the value of option \code{"printcmd"}. The
length limit is \code{2*PATH_MAX}, typically 8096 bytes on unix systems and
520 bytes on windows.}
\item{antialias}{string, the type of anti-aliasing (if any) to be used;
defaults to \code{"default"}.}
\item{defaultfont}{logical: should the device use xfig's default
font?}
\item{textspecial}{logical: should the device set the textspecial flag
for all text elements. This is useful when generating pstex from xfig
figures.}
}
\value{
\code{[any]}\cr The results of the evaluation of the \code{code}
argument.
}
\description{
Temporarily use a graphics device.
}
\section{Functions}{
\itemize{
\item \code{with_bmp}: BMP device
\item \code{with_cairo_pdf}: CAIRO_PDF device
\item \code{with_cairo_ps}: CAIRO_PS device
\item \code{with_pdf}: PDF device
\item \code{with_postscript}: POSTSCRIPT device
\item \code{with_svg}: SVG device
\item \code{with_tiff}: TIFF device
\item \code{with_xfig}: XFIG device
\item \code{with_png}: PNG device
\item \code{with_jpeg}: JPEG device
}}
\examples{
# dimensions are in inches
with_pdf(file.path(tempdir(), "test.pdf"), width = 7, height = 5,
plot(runif(5))
)
# dimensions are in pixels
with_png(file.path(tempdir(), "test.png"), width = 800, height = 600,
plot(runif(5))
)
}
\seealso{
\code{\link{withr}} for examples
\code{\link[grDevices]{Devices}}
}
|