design_plot | R Documentation |
Proves a simple interface to let users interactively design plots in ggformula, lattice, or ggplot2. An option is available to show the code used to create the plot. This can be copied and pasted elsewhere to (into an RMarkdown document, for example) to recreate the plot. Only works in RStudio. Requires the manipulate package.
design_plot(
data,
format,
default = format,
system = system_choices()[1],
show = FALSE,
title = "",
data_text = rlang::expr_deparse(substitute(data)),
...
)
data |
a data frame containing the variables that might be used in the plot.
Note that for maps, the data frame must contain coordinates of the polygons
comprising the map and a variable for determining which coordinates are part
of the same region. See |
format |
a synonym for |
default |
default type of plot to create; one of
|
system |
which graphics system to use (initially) for plotting (ggplot2 or lattice). A check box will allow on the fly change of plotting system. |
show |
a logical, if |
title |
a title for the plot |
data_text |
A text string describing the data. It must be possible to recover the data
from this string using |
... |
additional arguments |
Currently maps are only supported in ggplot2 and not in lattice.
Due to an unresolved issue with RStudio, the first time this function is called, and additional plot is created to correctily initialize the mainipulate frameowrk.
Nothing. Used for side effects.
## Not run:
mtcars2 <-
mtcars |>
mutate(
cyl2 = factor(cyl),
carb2 = factor(carb),
shape = c("V-shaped", "straight")[1 + vs],
gear2 = factor(gear),
transmission = c("automatic", "manual")[1 + am])
design_plot(mtcars2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.