plot_ortho: Scatterplot with orthogonal fit line

Description Usage Arguments Details Value Examples

Description

Simple scatterplot with orthogonal fit line and optional R2 value.

Usage

1
plot_ortho(x, y, col, lcol, ann = TRUE, ...)

Arguments

x

vector of x-axis values

y

vector of y-axis values

col

single value or vector of point colors

lcol

value for line colors

ann

logical, should annotation for R2 value be added to top of plot?

...

further arguments passed to other methods

Details

Uses prcomp to fit orthogonal line. Data are first centered but not scaled for PCA step, therefore, consider carefully whether unscaled data are meaningful in your use case. Plot aspect is fixed at asp=1.

Converting values to interpoint distances beforehand may be useful for comparing e.g., ordination scores.

Value

A plot object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(23)
N  <- 99
x  <- runif(N,0,1)
y1 <- x + rnorm(N, 0, .1)
y2 <- x + rnorm(N, 0, .5)
y3 <- rnorm(N, 0, x*.3)
set_par(4)
plot_ortho(x, y1)
plot_ortho(x, y2)
plot_ortho(x, y3)
plot_ortho(y3, x)

phytomosaic/ecole documentation built on May 6, 2019, 3:45 p.m.