Learn R Programming

bipartite (version 2.19)

visweb: Plotting function to visualize a bipartite food web

Description

This function draws a food web as a grid using a matrix. Colnames and rownames are used as labels and entries in the matrix are visualized by text and colours. It can also be used to plot bipartite webs in the style of Vázquez et al. (2009).

Usage

visweb(web, type="nested",  prednames=TRUE, preynames=TRUE, labsize=1,
  plotsize=12, square="interaction", text="no", frame=NULL, textsize=1,
  textcol="red", pred.lablength=NULL, prey.lablength=NULL, clear=TRUE,
  xlabel="", ylabel="", boxes=TRUE, circles=FALSE, circle.col="black",
  circle.min=0.2, circle.max=2, outerbox.border="white", 
  outerbox.col="white", box.border="black", box.col="black", def.col="blue", 
  max.digits=4, NA.col="red")

Value

A plot window with appropriate size according to the dimensions of the web.

Arguments

web

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.

type

type changes the sorting of rows and coloumns of the web and can be
nested : (sorted by row/colSums)
diagonal: (highest number of interactions appear along the diagonal, good for showing compartments)
none : (as is)

prednames

labels can be switched of by prednames=F

preynames

labels can be switched of by preynames=F

labsize

factor for size of labels

plotsize

size of plot (length of width or height), depending on the dimension of the web in cm, default is 12 cm.

square

square is used to indicate number of interactions and belonging to compartments by coloured grid cells
interaction: (level of grey indicates the number of intercation, white means no interaction)
compartment: (level of grey indicates belonging to the same compartment)
black : (black grid cells if number of interaction is bigger than one)
none : (no coloured squares are drawn)

text

number of interactions or belonging are plotted into each grid cell
interaction: (number of interactions are drawn)
compartment: (belonging to same compartment indicated by capitel Letters)
none : (no text is shown)

frame

a frame is drawn around each compartment (frame=TRUE), best used with type=“diagonal”

textsize

factor for size of text in squares, default=1

textcol

color of text in grid cells, default =“red”

pred.lablength

length of predators (upper) labels that should be displayed

prey.lablength

length of prey (lower) labels that should be displayed

clear

delete species with no interactions (compulsory done for “nested” and “diagonal”)

xlabel

label on the x-axis, make sure prey.lablength is set accordingly, default is empty

ylabel

label on the y-axis, make sure pred.lablength is set accordingly, default is empty

boxes

logical, if boxes should be drawn. Default is set to TRUE

circles

logical, if circles in a Vazquez et al. style should be drawn. Default is set to FALSE, size and colours of circles and background can be set by the following arguments

circle.col

Colour of circles, works only if circles=TRUE

circle.min

minimal size of circles, use to rescale circles appropriately, default is 0.2

circle.max

maximal size of circle, , use to rescale circles appropriately, default is 2

outerbox.border

Colour of outerbox border if option circles=TRUE

outerbox.col

Colour of background if option circles=TRUE

box.border

Colour of border of boxes, if option square=“b” is set

box.col

Colour of boxes, if option square=“b” is set

def.col

A user defined color vector for all ranks (starting from low to high) of occurring values in the network

max.digits

defaults to 4.

NA.col

Which colour should be used for missing data (NAs)? Defaults to red.

Author

Bernd Gruber

References

Vázquez, P.D., Chacoff, N.,P. and Cagnolo, L. (2009) Evaluating multiple determinants of the structure of plant-animal mutualistic networks. Ecology

See Also

For a different plot on food web see plotweb.

Examples

Run this code

data(Safariland)
visweb(Safariland)
visweb(Safariland, type="diagonal", square="compartment", text="none", 
	frame=TRUE)
visweb(Safariland, type="nested", text="compartment")
visweb(Safariland, circles=TRUE,  boxes=FALSE,  labsize=1, circle.max=3, 
	text="no")
visweb(Safariland,square="b",box.col="green",box.border="red")

#define your colors here,length has to be the numbers of different entries
cols <-0:(length(table(Safariland))-1) 
visweb(Safariland, square="defined", def.col=cols) 

Run the code above in your browser using DataLab