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).
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")
A plot window with appropriate size according to the dimensions of the 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 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)
labels can be switched of by prednames=F
labels can be switched of by preynames=F
factor for size of labels
size of plot (length of width or height), depending on the dimension of the web in cm, default is 12 cm.
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)
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)
a frame is drawn around each compartment (frame=TRUE), best used with type=“diagonal”
factor for size of text in squares, default=1
color of text in grid cells, default =“red”
length of predators (upper) labels that should be displayed
length of prey (lower) labels that should be displayed
delete species with no interactions (compulsory done for “nested” and “diagonal”)
label on the x-axis, make sure prey.lablength is set accordingly, default is empty
label on the y-axis, make sure pred.lablength is set accordingly, default is empty
logical, if boxes should be drawn. Default is set to TRUE
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
Colour of circles, works only if circles=TRUE
minimal size of circles, use to rescale circles appropriately, default is 0.2
maximal size of circle, , use to rescale circles appropriately, default is 2
Colour of outerbox border if option circles=TRUE
Colour of background if option circles=TRUE
Colour of border of boxes, if option square=“b” is set
Colour of boxes, if option square=“b” is set
A user defined color vector for all ranks (starting from low to high) of occurring values in the network
defaults to 4.
Which colour should be used for missing data (NAs)? Defaults to red.
Bernd Gruber
Vázquez, P.D., Chacoff, N.,P. and Cagnolo, L. (2009) Evaluating multiple determinants of the structure of plant-animal mutualistic networks. Ecology
For a different plot on food web see plotweb
.
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