prune: Prune a plant.

Description Usage Arguments Value See Also Examples

Description

If your plant is out of control and you have a bit of time on the weekend, get out the secateurs and tidy up the garden.

Usage

1
prune(x, intensity = 1, plot = TRUE, ...)

Arguments

x

A plant as returned by germinate.

intensity

The pruning depth. Default is 1.

plot

Should the plant be plotted?

...

Further arguments to plot.plant (ignored if plot is FALSE).

Value

a modified plant object with the outermost intensity stems hacked off.

See Also

germinate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
s <- seed(50, 10, min.branch.length=0, max.branch.length=5,
          min.trunk.height=5, max.trunk.height=8)
g <- germinate(s, col='navajowhite4')
prune(g, 3, xlim=par('usr')[1:2], ylim=par('usr')[3:4], xaxs='i', yaxs='i',
      col='navajowhite4')

s <- seed(70, 12, min.branch.length=0, max.branch.length=5,
          min.trunk.height=5, max.trunk.height=8)
g <- germinate(s, plot=FALSE)
par(mar=rep(0, 4), mfrow=n2mfrow(max(g$depth)+1))
plot(g, trunk.width=8, col='peachpuff4')
leafygreens <- colorRampPalette(paste0('darkolivegreen', c('', 1:4)))(100)
nleaves <- length(which(g$depth >= 3))
foliate(g, nleaves, 3, pch=24:25, col=NA, cex=1.8, bg=paste0(leafygreens, '30'))
for (i in seq_len(max(g$depth))) {
  g <- prune(g, 1, xlim=par('usr')[1:2], ylim=par('usr')[3:4],
             xaxs='i', yaxs='i', col='peachpuff4', trunk.width=5)
  nleaves <- length(which(g$depth >= 3))
  nleaves
  if (nleaves > 0) foliate(g, nleaves, 3, pch=24:25, col=NA, cex=1.5,
                           bg=paste0(leafygreens, '30'))
}

johnbaums/trees documentation built on May 19, 2019, 3:03 p.m.