Description Usage Arguments Value See Also Examples
Add squirrels (for example) at specific locations defined by branch address and distance along branch.
1 |
x |
A |
branches |
A binary coded vector of addresses of branches upon which
squirrels (for example) will be placed. The trunk should be coded as
|
pos |
A vector whose elements describe the position of squirrels (for
example), expressed as the distance from the beginning of the branch. This
vector must be the same length as |
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 points be added to the current plot? |
... |
Additional arguments controlling the appearance of squirrels (for
example), passed to |
A data.frame
with branch addresses (branches
), squirrel
positions (pos
), and the corresponding x
and y
coordinates. If plot
is TRUE
, the points will be added to the
current plot.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # From http://stackoverflow.com/q/28163979/489704
g <- 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)
xy <- squirrels(g, c('Y', '0', '010', '0', '00'), pos=c(23, 12, 4, 2, 1),
pch=21, bg='white', cex=3, lwd=2)
text(xy$x, xy$y, labels=seq_len(nrow(xy)), font=2)
legend('bottomleft', bty='n',
legend=paste(seq_len(nrow(xy)),
c('FluffyTail', 'Ginger', 'NutCracker', 'SuperSquirrel',
'ChipnDale'), sep='. '))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.