replace | R Documentation |
Replace a figure with another figure
replace(obj, index, replacement, visible)
## S3 method for class 'figure'
replace(obj, index, replacement, visible = FALSE)
obj |
A figure composed of different figures |
index |
integer, the index of the element to replace |
replacement |
The figure with which the original one is replaced |
visible |
logical, if TRUE it will replace only the visible figure. Default is FALSE |
An object with a changed figure
The starting object with a replaced figure
An object with a changed figure
The starting object with a replaced figure
replace(figure)
: Replace figures
Replace a figure with another figure
# concanate three figures into an object
my_shapes <- cof(square(), triangle(), slice())
# draw object
draw(my_shapes)
# replace the square with a gray pacman
draw(replace(my_shapes, 1, pacman(shd = "grey")))
# concanate three figures into an object
my_shapes <- cof(square(), triangle(), slice())
# draw object
draw(my_shapes)
# replace the square with a gray pacman
draw(replace(my_shapes, 1, pacman(shd = "grey")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.