plotweb | R Documentation |
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)
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 |
Sorting option passed to the |
empty |
If |
higher_abundances |
Vector with independent abundance estimates for the higher trophic level, |
lower_abundances |
Vector with independent abundance estimates for the lower trophic level, |
add_higher_abundances |
Vector with additional abundances (e.g. unparasitised hosts) for the higher trophic level, |
add_lower_abundances |
Vector with additional abundances (e.g. unparasitised hosts) for the lower trophic level, |
higher_labels |
Boolean or named list. Indicating whether the higher labels should be plotted. Named list may be used for abbrevations or partly cursive labels. |
lower_labels |
Boolean or named list. Indicating whether the lower labels should be plotted. Named list may be used for abbrevations or partly cursive labels. |
scaling |
Choice of either |
font |
An integer which specifies which font to use for the labels. See |
family |
The name of a font family for drawing the labels. See |
srt |
Orientation of the labels in degrees. (Default: |
text_size |
Factor by which the size of the label text should be scaled. Values < 1 makes them smaller, values > 1 makes them greater. (Default: |
spacing |
Either |
plot_axes |
Indicates whether both axes should be drawn on the plot. (Default: |
box_size |
Size of the boxes. Numerical with either c(higher_box_size, lower_box_size) or one value if both should be the same. (Default: |
higher_italic |
If set to |
lower_italic |
If set to |
x_lim |
Vector with 2 numerical values. The range in which to plot on the x-axis. (Default: |
y_lim |
Vector with 2 numerical values. The range in which to plot on the y-axis. (Default: |
lab_distance |
Distance between the boxes and the labels in inches |
higher_color |
A single color or a list of colors used to plot the higher species (columns) boxes. (Default: |
higher_border |
Either |
higher_add_color |
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: |
higher_text_color |
A single color or a list of colors used to plot the lower species (rows) labels. (Default: |
lower_color |
A single color or a list of colors used to plot the lower species (rows) boxes. (Default: |
lower_border |
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. |
lower_add_color |
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") |
lower_text_color |
A single color or a list of colors used to plot the lower species (rows) labels. (Default: |
horizontal |
Boolean indicating whether the connection between the boxes and the label texts should be plotted horizontally. (Default: FALSE) |
link_color |
"lower", "higher", or single color value. 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") |
link_border |
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. |
link_alpha |
Number between 0.0 and 1.0 setting the transparency of the links. 0 means full transparency 1 means full opacity. (Default: 0.5) |
curved_links |
If |
arrow |
Display type of connection between higher and lower boxes, options are
|
add |
If set to |
mar |
A numerical vector of the form |
mai |
A numerical vector of the form |
Returns a window with a bipartite graph of the given web.
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.
Note the difference between relative and absolute scaling is mainly important in the case either additional or independent abundances 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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.