This is the help file for the new plotweb implementation. For help with the old, deprecated plotweb function see plotweb_deprecated.
A more in depth guide on how to use this function to plot biparitte networks with multiple visual examples
is given in the vignette PlottingWithBipartite
.
A two dimensional matrix is plotted as a bipartite graph.
plotweb(web,
sorting = "normal",
empty = FALSE,
higher_abundances = NULL,
lower_abundances = NULL,
add_higher_abundances = NULL,
add_lower_abundances = NULL,
higher_labels = NULL,
lower_labels = NULL,
scaling = "relative",
font = NULL,
family = NULL,
srt = 0,
higher_italic = FALSE,
lower_italic = FALSE,
text_size = "auto",
spacing = 0.3,
box_size = 0.1,
x_lim = c(0, 1),
y_lim = c(0, 1),
lab_distance = 0.05,
lower_color = "black",
lower_border = "same",
lower_add_color = "red",
lower_text_color = "black",
higher_color = "black",
higher_border = "same",
higher_add_color = "red",
higher_text_color = "black",
horizontal = FALSE,
link_color = "higher",
link_border = "same",
link_alpha = 0.5,
curved_links = FALSE,
arrow = "no",
plot_axes = FALSE,
add = FALSE,
mar = c(1, 1, 1, 1),
mai = NULL)
Returns a window with a bipartite graph of the given 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.
Sorting option passed to the sortweb
function. The default "normal"
doesn't reorder the web.
If TRUE
empty columns and rows are removed from the web.
Vector with independent abundance estimates for the higher trophic level, NULL
if none exist. See Notes!
Vector with independent abundance estimates for the lower trophic level, NULL
if none exist. See Notes!
Vector with additional abundances (e.g. unparasitised hosts) for the higher trophic level, NULL
if none exist. See Notes!
Vector with additional abundances (e.g. unparasitised hosts) for the lower trophic level, NULL
if none exist. See Notes!
Boolean or named list. Indicating whether the higher labels should be plotted. Named list may be used for abbrevations or partly cursive labels.
Boolean or named list. Indicating whether the lower labels should be plotted. Named list may be used for abbrevations or partly cursive labels.
Choice of either "relative"
or "absoulte"
. For more information see Scaling.
An integer which specifies which font to use for the labels. See par
.
The name of a font family for drawing the labels. See par
.
Orientation of the labels in degrees. (Default: 0
)
Factor by which the size of the label text should be scaled. Values < 1 makes them smaller, values > 1 makes them greater. (Default: "auto"
)
Either "auto"
, a single value or a numerical vector of the form c(higher, lower)
. Defines the total space between boxes. See Notes! (Default: 0.3
)
Indicates whether both axes should be drawn on the plot. (Default: FALSE
)
Size of the boxes. Numerical with either c(higher_box_size, lower_box_size) or one value if both should be the same. (Default: 0.1
)
If set to TRUE
, the labels of the higher species are plotted in italics. (Default: FALSE
)
If set to TRUE
, the labels of the lower species are plotted in italics. (Default: FALSE
)
Vector with 2 numerical values. The range in which to plot on the x-axis. (Default: c(0, 1)
)
Vector with 2 numerical values. The range in which to plot on the y-axis. (Default: c(0, 1)
)
Distance between the boxes and the labels in inches
A single color or a list of colors used to plot the higher species (columns) boxes. (Default: "black"
)
Either "same"
or a single color or a list of colors used to plot the higher species (columns) boxes borders.
If "same"
, the borders have the same color as the corresponding boxes.
Only used when higher additional abundances are defined.
A single color or a list of colors used to plot the higher (column) additional boxes. (Default: "red"
)
A single color or a list of colors used to plot the lower species (rows) labels. (Default: "black"
)
A single color or a list of colors used to plot the lower species (rows) boxes. (Default: "black"
)
Either "same" or a single color or a list of colors used to plot the lower species (rows) boxes borders. If "same", the borders have the same color as the corresponding boxes.
Only used when lower additional abundances are defined. A single color or a list of colors used to plot the lower (row) additional boxes. (Default: "red")
A single color or a list of colors used to plot the lower species (rows) labels. (Default: "black"
)
Boolean indicating whether the connection between the boxes and the label texts should be plotted horizontally. (Default: FALSE)
"lower", "higher", a single color value, or a matrix with color values for each entry in the interaction web. If "lower" or "higher" the link color is taken from the corresponding lower or higher box. Otherwise all links have the defined color. (Default: "higher")
Either "same" or a single color or a list of colors used to plot the link borders. If "same", the borders have the same color as the corresponding boxes.
Number between 0.0 and 1.0 setting the transparency of the links. 0 means full transparency 1 means full opacity. (Default: 0.5)
If FALSE
links are plotted as straight lines otherwise they are curved. (Default: FALSE
)
Display type of connection between higher and lower boxes, options are
"no"
(Default)
"up"
"down"
"both"
"up.center"
"down.center"
"both.center"
If set to TRUE
a new bipartite network plot is added to the previous plot. (Default: FALSE
)
A numerical vector of the form c(bottom, left, top, right)
which gives the number of lines of margin to be specified on the four sides of the plot.
The default is NULL which takes the global setting from par()
.
A numerical vector of the form c(bottom, left, top, right)
which gives the margin size specified in inches.
Please note, that the margin is increased so that the labels are always visible in the plot.
The "auto"
text_size
or spacing
option can be very handy for quickly creating a plot.
However in certain cases it might not produce the best results.
Especially in cases where there are plenty species with rather long names or multiple species with low abundances,
the labels can tend to overlap.
In those cases defining the spacing
and text_size
manually or rotating the labels with the srt
argument might produce better results.
Special care must be taken if two different values are passed to the argument for the higher and lower species.
The total size of the boxes will not be comparable between the sides in that case.
So especially using the argument scaling = "absolute"
might not yield the intended result.
Both independent as well as additional abundances should be passed as a named vector.
If no independent abundances are given the row and column sums are used to calculate the size of the boxes.
The scaling option is only relevant, if either independent or additional or both have been defined.
In case "relative"
is selected the boxes of higher and lower abundances are scaled so that they both utilize the whole space.
In case "absolute"
is selected only the boxes of the side with the higher total abundances uses the full space the other side is then scaled relatively to that side.
So that species with the same abundance are plotted with boxes of the same size.
Be extra careful about the spacing
option when using "absolute"
scaling.
Tobias Bauer tobias.bauer-2@uni-hamburg.de
For a different plot of food webs see visweb
data(Safariland)
plotweb(Safariland)
# To let the plot look a bit more modern
plotweb(Safariland, horizontal = TRUE, curved_links = TRUE)
Run the code above in your browser using DataLab