plotweb | R Documentation |
A two dimensional matrix is plotted as a bipartite graph.
plotweb(web,
method = "cca", empty = TRUE, labsize = 1, ybig = 1, y.width.low = 0.1,
y.width.high = 0.1, low.spacing = NULL, high.spacing = NULL,
arrow="no", col.interaction="grey80", col.high = "grey10",
col.low="grey10", bor.col.interaction ="black", bor.col.high="black",
bor.col.low="black", high.lablength = NULL, low.lablength = NULL,
sequence=NULL, low.abun=NULL, low.abun.col="green",
bor.low.abun.col ="black", high.abun=NULL, high.abun.col="red",
bor.high.abun.col="black", text.rot=0, text.high.col="black",
text.low.col="black", adj.high=NULL, adj.low=NULL, plot.axes = FALSE,
low.y=0.5, high.y=1.5, add=FALSE, y.lim=NULL, x.lim=NULL, low.plot=TRUE,
high.plot=TRUE, high.xoff = 0, low.xoff = 0, high.lab.dis = NULL,
low.lab.dis = NULL, abuns.type="additional")
web |
Web is a matrix representing the interactions observed between higher trophic level species (columns) and lower trophic level species (rows). Usually this will be number of pollinators on each species of plants or number of parasitoids on each species of prey. |
method |
Default method is cca, which leads to as few crossings of interactions as possible. The other option is normal, which leaves order as given by the matrix. |
empty |
logical; should empty columns or empty rows be omitted from plotting; defaults to true |
labsize |
factor for size of labels, default is 1 |
ybig |
vertical distance between upper and lower boxes, default is 1 |
y.width.low |
width of lower boxes, default is 0.1 |
y.width.high |
width of upper boxes, default is 0.1 |
low.spacing |
distance between lower boxes, default is NULL, so automatically spaced that length of upper and lower boxes is the same. Be aware if set to any value that x.lim may has to be adjusted to ensure that the network is not plotted outside the plotting region |
high.spacing |
distance between upper boxes, default is is NULL, so automatically spaced that length of upper and lower boxes is the same. Be aware if set to any value that x.lim may has to be adjusted to ensure that the network is not plotted outside the plotting region |
arrow |
display type of connection between upper and lower boxes, options are up, down, both, up.center, down.center, both.center and no, default is no, which is a polygonal connection between boxes. |
col.interaction |
color of interaction, default is grey80. |
col.high |
color of upper boxes, default is grey10. |
col.low |
color of lower boxes, default is grey10. |
bor.col.interaction |
border color of interaction, default is black |
bor.col.high |
border color of upper boxes, default is black |
bor.col.low |
border color of lower boxes, default is black |
high.lablength |
number of characters of upper labels that should be plotted. If zero no labels are shown, default is NULL which plots the complete labels. |
low.lablength |
number of characters of lower labels that should be plotted. If zero no labels are shown, default is NULL which plots the complete labels. |
sequence |
list of two with two names vectors: |
low.abun |
Named vector with independent abundance estimates for the lower trophic level, NULL if none exists. See Notes! |
low.abun.col |
Colour for depicting the abundance estimates for the lower trophic level; defaults to green. |
bor.low.abun.col |
border color for depicting the abundance estimates for the lower trophic level, default is black |
high.abun |
Named vector with independent abundance estimates for the higher trophic level, NULL if none exists. See Notes! |
high.abun.col |
Colour for depicting the abundance estimates for the lower trophic level; defaults to red. |
bor.high.abun.col |
border color for depicting the abundance estimates for the higher trophic level, default is black |
text.rot |
orientation of labels in the plot (to avoid overlapping of horizontal labels if dimension of the webs are high), default is 0 for horizontal labels, use text.rot=90 for vertical labels. |
text.high.col |
Colour for text labels of higher trophic level, a vector of colours can be given |
text.low.col |
Colour for text labels of lower trophic level. A vector of colours can be given |
adj.high |
Adjust upper labels. See adj in ?text how to adjust labels |
adj.low |
Adjust upper labels. See adj in ?text how to adjust labels |
plot.axes |
axis are plotted. Sometimes useful to place boxes in higher order plots. Defaults to FALSE |
low.y |
Position of the higher boxes on the y-axis. Defaults to 1.5 |
high.y |
Position of the higher boxes on the y-axis. Defaults to 1.5 |
add |
if set to TRUE a new bipartite network is added to the previous plot. In this way multitrophic webs can be plotted, see examples below. Defaults to FALSE. |
y.lim |
To set limits for y-axis. Useful if labels are plotted outside the plotting region and for multitrophic plots, see examples below |
x.lim |
To set limits for x-axis. Useful if labels are plotted outside the plotting region and for multitrophic plots, see examples below |
low.plot |
Defines if lower boxes should be drawn. Use in multitrophic plots to avoid plotting boxes of some trophic levels - see examples below. Defaults to TRUE |
high.plot |
Defines if higher boxes should be drawn. Use in multitrophic plots to avoid plotting boxes of some trophic levels - see examples below. Defaults to TRUE |
high.xoff |
allows to set an offset to upper boxes. Useful if high.spacing is used to centre boxes manually. Use plot.axes=TRUE for easy centring |
low.xoff |
allows to set an offset to lower boxes. Useful if low.spacing is used to centre boxes manually. Use plot.axes=TRUE for easy centring |
high.lab.dis |
normally labels are staggered to avoid plotting over themselves. if set to 0, higher labels are all on one horizontal line. By using ad.low the position of the labels can be adjusted. If set to any other value labels are staggered with this distance. Defaults to NULL |
low.lab.dis |
normally labels are staggered to avoid plotting over themselves. if set to 0, lower labels are all on one horizontal line. By using ad.low the position of the labels can be adjusted. If set to any other value labels are staggered with this distance. Defaults to NULL |
abuns.type |
How to plot abundances - are they independent (e.g. flower cover) measurements or are they additional (e.g. unparasitised hosts) measurements? Defaults to additional. Option none is interpreted in the same way as additional. See Notes! |
Returns a window with a bipartite graph of a food web. For all colours vectors can be used (which are recycled if length differs. Now more trophic webs can be plotted by using plotweb
and the add switch, which allows to add more webs and staggering them on top of each other. Preferred option is here to order webs by yourself and use method="normal" to keep your preferred order. See examples on three and four trophic networks.
Note that in previous implementations, low.abun and high.abun was actually treated as 'additional abundances' (e.g. unparasitised hosts). We added the parameter abuns.type to switch between the classic function (values none and additional, the default for backward compatibility) and an alternative function that plots fully independent abundance estimates (abuns.type="independent"). To change box (species) colors with abuns.type='independent', use low.abun.col and high.abun.col. The function will likely be revised again in the future, so feedback welcome.
If you have total abundance measure but want to plot used and unused resources, use abuns.type='additional' and low.abun= your.low.abun - rowSums(web).
Bernd Gruber bernd.gruber@canberra.edu.au
Tylianakis, J. M., Tscharntke, T. and Lewis, O. T. (2007) Habitat modification alters the structure of tropical host-parasitoid food webs. Nature 445, 202–205
For a different plot of food webs see visweb
data(Safariland)
plotweb(Safariland)
# shorter labels
plotweb(Safariland, high.lablength=3, low.lablength=0, arrow="down")
# centered triangles for displaying interacions
plotweb(Safariland, text.rot=90, arrow="down.center", col.interaction="wheat2",
y.lim=c(-1,2.5))
#orginal sequence, up arrows and different box width
plotweb(Safariland, method="normal", arrow="up", y.width.low=0.3, low.lablength=4)
# interactions as lines
plotweb(Safariland, arrow="both", y.width.low=0.05, text.rot=90, col.high="blue",
col.low="green")
# add an abundance vector for lower trophic species
low.abun = round(runif(dim(Safariland)[1],1,40)) #create
names(low.abun) <- rownames(Safariland)
plotweb(Safariland, text.rot=90, low.abun=low.abun, col.interaction="purple",
y.width.low=0.05, y.width.high=0.05)
plotweb(Safariland, text.rot=90, low.abun=low.abun, col.interaction ="red",
bor.col.interaction="red", arrow="down")
# now vectors for all colours can be given, to mark certain species or
# interactions. Colour vectors are recycled if not of appropriate length
plotweb(Safariland,col.high=c("orange","green"))
plotweb(Safariland,col.low=c("orange","green"),col.high=c("white","grey","purple"),
text.high.col=c("blue","red"), col.interaction=c("red",rep("green",26),rep("brown",242)),
bor.col.interaction=c(rep("green",26),rep("brown",242)),method="normal",
text.rot=90, low.lablength=10, high.lablength=5)
#example one (tritrophic)
plotweb(Safariland,y.width.low=0.1, y.width.high=0.05,method="normal",
y.lim=c(0,3), arrow="up", adj.high=c(0.5,1.5), col.high="orange",
high.lablength=3,high.lab.dis=0)
plotweb(t(Safariland), y.width.low=0.05, y.width.high=0.1, method="normal",
add=TRUE,low.y=1.5,high.y=2.5, col.low="green", text.low.col="red",
low.lab.dis=0, arrow="down", adj.low=c(0.5,1.1),low.plot=FALSE)
#example two (4 trophic with abundance)
low.abun = round(runif(dim(Safariland)[1],1,40)) #create
names(low.abun) <- rownames(Safariland)
plotweb(Safariland, text.rot=90, high.abun=low.abun, col.interaction="purple",
y.lim=c(0,4.5), high.lablength=0, arrow="up", method="normal",
y.width.high=0.05)
plotweb(t(Safariland), y.width.low=0.05, y.width.high=0.1, method="normal",
add=TRUE, low.y=1.7,high.y=2.7, col.low="green", text.low.col="black",
low.lab.dis=0, arrow="down", adj.low=c(0.5,1.1), low.lablength=4,
high.lablength=0)
plotweb(Safariland,y.width.low=0.05, y.width.high=0.1, method="normal",
add=TRUE, low.y=2.95, high.y=3.95, col.low="green", text.low.col="black",
low.lab.dis=0, arrow="down", adj.low=c(0.5,1.1), low.lablength=4)
# now some examples with the abuns.type-option:
plotweb(Safariland, abuns.type='independent',arrow="down.center")
plotweb(Safariland, abuns.type='additional',arrow="down.center")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.