effectiveness_plot: Function to plot effectiveness landscapes, with repel labels...

Description Usage Arguments Details Value Examples

View source: R/effectiveness_plot.R

Description

Function to plot effectiveness landscapes, with repel labels option.

Usage

1
2
3
4
5
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", ...)

Arguments

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 q1.

q2.error

Optional. Numeric vector to be used as error bars for q2.

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 q1 and q2 providing a label for the individual points (e.g., species acronym). Note that label may be NA for some points (useful to avoid overplotting of labels).

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 "style" (e.g. "quantile", "equal", or "pretty") to choose optimal breaks using classIntervals. Note that using "pretty" will override nlines, as the number of lines will be determined algorithmically. See classIntervals for more details.

lines.color

Color of the isolines.

myxlab

optional label for axis X.

myylab

optional label for axis Y.

...

Further arguments to be passed to geom_text_repel (apart from segment_size, segment_alpha, and fontface, which are already defined in this function).

Details

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.

Value

A ggplot2 object, which can be later modified (see examples).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#------------------------------------------------------------------------
# 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()

pedroj/effectiveness_pckg documentation built on Nov. 26, 2019, 11:02 p.m.