PlotWebByLevel: Plot web by level

Description Usage Arguments Details Author(s) See Also Examples

View source: R/graph_nodes.R

Description

A high-level function for plotting a food-web by vertically with the lowest trophic-level nodes at the bottom.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
PlotWebByLevel(community, 
               level='PreyAveragedTrophicLevel', 
               max.nodes.per.row=20,
               round.levels.to.nearest=0.2,
               stagger=0.1, 
               x.layout='wide', 
               y.layout='compress', 
               show.level.labels=TRUE,
               show.level.lines=FALSE, 
               xaxt='n', 
               yaxt='n', 
               xlab='', 
               ylab='', 
               frame.plot=FALSE,
               ylim=NULL,
               ...)

Arguments

community

an object of class Community

level

either a function, a name that meets the criteria of the properties parameter of NPS or a vector of length NumberOfNodes, which must contain numbers greater than 0.

max.nodes.per.row

a number greater than 2.

round.levels.to.nearest

a number greater or equal to 0 and less than 1.

stagger

a number greater or equal to 0 and less than 1. Only used if y.layout is 'stagger'.

x.layout

'skinny', 'narrow' or 'wide'.

y.layout

'stagger' or 'compress'. Only has an effect if round.levels.to.nearest is greater than 0.

show.level.labels

logical - if TRUE then integer values of level are shown to the left of the plot.

show.level.lines

logical - if TRUE then a horizontal line is drawn for each unique value of level.

xaxt

a character that specifies the type of the x axis.

yaxt

a character that specifies the type of the y axis.

xlab

title of the x axis.

ylab

title of the y axis.

frame.plot

logical - if TRUE then a border is drawn around the plot.

ylim

limits of the y axis

...

other values to PlotNPS.

Details

If round.levels.to.nearest is greater than 0, values in level are rounded to the nearest round.levels.to.nearest. Rounded values are used by the x.layout and y.layout engines.

If x.layout is 'skinny' then nodes are spaced one x unit apart and max.nodes.per.row is ignored. If x.layout is 'narrow', nodes are spaced one x unit apart if fewer than max.nodes.per.row on that row, otherwise nodes are squashed in to the available x space. If x.layout is 'wide', nodes are spaced widely.

If y.layout is 'compress', then nodes are always shown at the values in level. If y.layout is 'stagger' and there are more than max.nodes.per.row on a level then the plotted levels are staggered by the values in stagger.

Author(s)

Lawrence Hudson

See Also

Community, PlotBSpectrum, PlotCircularWeb, PlotNPS, PlotNPSDistribution, PlotNSpectrum, PlotRankNPS, PlotTLPS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Compare prey-averaged and chain-averaged trophic level
data(TL84)
par(mfrow=c(1,2))
PlotWebByLevel(TL84, ylim=c(1,5.8), main='Prey-averaged')
PlotWebByLevel(TL84, ylim=c(1,5.8), level='ChainAveragedTrophicLevel', 
               main='Chain-averaged')

# Compare the three different x layouts
par(mfrow=c(1,3))
for(x.layout in c('skinny', 'narrow', 'wide'))
{
    PlotWebByLevel(TL84, x.layout=x.layout, main=x.layout)
}

# Compare the effect of round levels before plotting
# Different x-spacing of the four nodes around level 3
par(mfrow=c(1,2))
PlotWebByLevel(TL84, round.levels.to.nearest=0.2)
PlotWebByLevel(TL84, round.levels.to.nearest=0)

# Compare the effect of staggering levels
# Primary producers are staggered in the second plot
par(mfrow=c(1,2))
# No staggering - stagger and max.nodes.per.row are ignored
PlotWebByLevel(TL84, y.layout='compress')
# Stagger
PlotWebByLevel(TL84, y.layout='stagger', stagger=0.1, 
               max.nodes.per.row=20)

quicklizard99/cheddar documentation built on June 10, 2018, 12:15 p.m.