View source: R/effectiveness_plot.R
effectiveness_plot | R Documentation |
Function to plot effectiveness landscapes, with repel labels option.
effectiveness_plot(q1, q2, q1.error = NULL, q2.error = NULL,
pts.shape = NULL, pts.color = NULL, pts.size = 2, label = NA,
label.size = 3, italic = FALSE, show.lines = TRUE, nlines = 6,
lines.breaks = "quantile", lines.color = "grey50",
myxlab = "QtComp", myylab = "QltComp", ...)
q1 |
Numeric vector representing the "quantitative component", to plot on the X axis. |
q2 |
Numeric vector representing the "qualitative component", to plot on the Y axis. |
q1.error |
Optional. Numeric vector to be used as error bars for |
q2.error |
Optional. Numeric vector to be used as error bars for |
pts.shape |
Optional. A grouping variable (< 7 groups) to set point shapes (e.g., family). |
pts.color |
Optional. A grouping variable to set point colours (e.g., family). |
pts.size |
Optional. Size of points. |
label |
Optional. A character vector of the same length as |
label.size |
Size of point labels. |
italic |
Logical. Use italic font for labels? |
show.lines |
Logical. Show effectiveness isolines? (default is TRUE). |
nlines |
Specify the number of isolines. |
lines.breaks |
Either a numeric vector giving break points for the contour lines, or a |
lines.color |
Color of the isolines. |
myxlab |
optional label for axis X. |
myylab |
optional label for axis Y. |
... |
Further arguments to be passed to |
The script plots effectiveness landscapes as described in Schupp, E. W., Jordano, P. and Gómez, J.M. 2010. Seed dispersal effectiveness revisited: a conceptual review. New Phytologist 188: 333-353.
A ggplot2 object, which can be later modified (see examples).
#------------------------------------------------------------------------
# Based on a dataset of Cecropia glaziovii frugivores.
# In this example we build the effectiveness landscape just for the
# quantitative component, plotting its two subcomponents, visitation
# rate and per-visit effectiveness.
#------------------------------------------------------------------------
data(cecropia)
effectiveness_plot(q1 = cecropia$totvis, q2 = cecropia$totbic,
myxlab= "No. visits/10h",
myylab="Effectiveness/vis (No. fruits handled)")
#------------------------------------------------------------------------
## Avoiding label overplotting ##
## e.g. showing only names of species with high effectiveness
labels = cecropia$code
labels[4:length(cecropia$code)] <- NA
effectiveness_plot(q1 = cecropia$totvis, q2 = cecropia$totbic,
label = labels,
myxlab= "No. visits/10h",
myylab="Effectiveness/vis (No. fruits handled)")
################################################
## Modify plot ##
myplot <- effectiveness_plot(q1 = cecropia$totvis, q2 = cecropia$totbic,
label = labels, nlines = 10,
myxlab= "No. visits/10h",
myylab="Effectiveness/vis (No. fruits handled)")
myplot + ggplot2::theme_minimal()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.