Debian Codegraph @

man/with_par.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/par.R
3 \name{with_par}
4 \alias{with_par}
5 \alias{local_par}
6 \title{Graphics parameters}
7 \usage{
8 with_par(new, code, no.readonly = FALSE)
9
10 local_par(
11 .new = list(),
12 ...,
13 no.readonly = FALSE,
14 .local_envir = parent.frame()
15 )
16 }
17 \arguments{
18 \item{new, .new}{\verb{[named list]}\cr New graphics parameters and their values}
19
20 \item{code}{\code{[any]}\cr Code to execute in the temporary environment}
21
22 \item{no.readonly}{\verb{[logical(1)]}\cr see \code{\link[=par]{par()}} documentation.}
23
24 \item{...}{Additional graphics parameters and their values.}
25
26 \item{.local_envir}{\verb{[environment]}\cr The environment to use for scoping.}
27 }
28 \value{
29 \code{[any]}\cr The results of the evaluation of the \code{code}
30 argument.
31 }
32 \description{
33 Temporarily change graphics parameters.
34 }
35 \examples{
36 old <- par("col" = "black")
37
38 # This will be in red
39 with_par(list(col = "red", pch = 19),
40 plot(mtcars$hp, mtcars$wt)
41 )
42
43 # This will still be in black
44 plot(mtcars$hp, mtcars$wt)
45
46 par(old)
47 }
48 \seealso{
49 \code{\link{withr}} for examples
50
51 \code{\link[=par]{par()}}
52 }