replace {matRiks} | R Documentation |
Replace figures (Method)
Description
Replace a figure with another figure
Usage
replace(obj, index, replacement, visible)
## S3 method for class 'figure'
replace(obj, index, replacement, visible = FALSE)
Arguments
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 |
Value
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
Methods (by class)
-
replace(figure)
: Replace figuresReplace a figure with another figure
Examples
# 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")))
[Package matRiks version 0.1.3 Index]