plot_lmodel2: Scatter plot with ggplot2

Description Usage Arguments Value Author(s)

Description

Handy scatter plot using ggplot2 that can display regression calculated by lmodel2.

Usage

1
2
3
plot_lmodel2(data, x, y, method = "OLS", mod.line = F, group = NA,
  same.panel = TRUE, xpos = 0.3, ypos = 0.8, pt.col = "blue",
  pt.shape = 1, ...)

Arguments

data

A data frame.

x, y

What to plot as x and y variable.

method

Which regression analysis to calculate. There are three methods to choose: "OLS"(ordinary least square), "MA"(Major Axis) and "SMA" (Standardised Major Axis or known as Reduced Major Axis). There are calculated using the lmodel2 function. Default is "OLS".

mod.line

Should 1:1, 2:1 and 1:2 lines be drawn. Default is FALSE.

group

The column name by which the data should be grouped.

same.panel

Should all the groups be plotted in the same panel. Default is TRUE. If not they will be separated in different facets as in ggplot2.

xpos, ypos

The relative x and y positions where the regression equations should be added. This should be a value between 0 and 1. This value multiples the maximum of the x or y limit gives the (x, y) coordinates of the annotation.

pt.col, pt.shape

The colour and shape of the points if only 1 group is plotted.

...

Arguments passed to aes

Value

A ggplot2 object

Author(s)

Hao Wu


MohoWu/utilr documentation built on May 9, 2019, 2 a.m.