Description Usage Arguments Value See Also Examples
Observe the miracle of life as your seed germinates and spews forth a glorious tree.
1 2 |
x |
Either a
|
angle |
The angle of branches relative to their parent branch (or relative to the trunk). This angle is negated for left-pointing branches. |
trunk.width |
The line width of the trunk. Widths are then scaled down for successive child branches, to a minimum of 1. |
left |
The character used to represent left-turning branches in the
|
right |
The character used to represent right-turning branches in the
|
plot |
Should the tree be plotted? (logical). |
... |
Further arguments to |
a plant
object, which is a data.frame
comprising branch
addresses, depths, lengths, angles, base coordinates, and tip coordinates.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Motivating example from http://stackoverflow.com/q/28163979/489704.
# Pass a named list (describing the seed) to germinate.
germinate(list(trunk.height=32,
branches=c('0', '1', '00', '01', '010', '011'),
lengths=c(21, 19, 5, 12, 6, 2)),
left='0', right='1', angle=40)
# Or simulate a seed and pass it directly to germinate
s <- seed(50, 10, min.branch.length=0, max.branch.length=5,
min.trunk.height=3, max.trunk.height=5)
g <- germinate(s, trunk.width=15)
# Additional realism (hard to imagine!) is possible by actually plotting the
# trees in a browny colour...
plot(g, trunk.width=15, col='peachpuff4')
# (Pro-tip: see ?foliate for more realism)
# In addition to the mighty oaks above, you might also like to germinate a
# clumpy grassy-type thing
s <- seed(60, 15, min.branch.length=0, max.branch.length=5,
min.trunk.height=0, max.trunk.height=0)
g <- germinate(s, angle=5, trunk.width=10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.