plot.cellular_automata {cellularautomata} | R Documentation |
Plot a cellular automaton
Description
Plot a cellular automaton
Usage
## S3 method for class 'cellular_automata'
plot(
x,
time_flow = "down",
circle = FALSE,
title = paste("Rule: ", attr(x, "wolfram_rule")),
animate = FALSE,
...
)
Arguments
x |
A cellular automaton, usually previously defined by 'ca()'. |
time_flow |
String: "down" (default) or "up". Whether time flow is represented as going from top-to-bottom or bottom-to-top. |
circle |
Whether to make the plot circular. Default is FALSE. |
title |
Title of the plot. Use 'NULL' to remove. |
animate |
Whether to return a gganimate object instead of a static ggplot. Default FALSE. |
... |
Not used (included for consistency with the 'plot' generic). |
Value
A ggplot of the visual representation of the cellular automaton, or a gganimate object.
Examples
ca(30) |> plot()
ca(30, ncols = 100, steps = 100) |> plot()
ca(45, ncols = 100, steps = 100) |> plot()
ca(86, ncols = 100, steps = 100) |> plot()
# use a random initial state
ca(126,
initialstate = sample(c(0, 1), size = 100, replace = TRUE),
steps = 100) |>
plot()
[Package cellularautomata version 0.1.0 Index]