includeLegend: Include Legend

Description Usage Arguments Value See Also Examples

View source: R/mcrIncludeLegend.r

Description

Include legend in regression plot (function plot()) or in bias plot (function plotBias ()) with two or more lines.

Usage

1
2
3
4
5
includeLegend(models = list(), digits = 2, design = paste(1:2),
  place = c("topleft", "topright", "bottomleft", "bottomright"), colors,
  lty = rep(1, length(models)), lwd = rep(2, length(models)),
  box.lty = "blank", cex = 0.8, bg = "white", inset = c(0.01, 0.01),
  bias = FALSE, model.names = NULL, ...)

Arguments

models

list of length n with Objects of class "MCResult".

digits

number of digits in Coefficients.

design

type of legend design. There are two possible designs: "1" and "2" (See example).

place

place for Legend: "topleft","topright","bottomleft" or "bottomright".

colors

vector of length n with color of regression lines.

lty

vector of length n with type of regression lines.

lwd

vector of length n with thickness of regression lines.

box.lty

box line-type

cex

numeric value representing the plotting symbol magnification factor

bg

the background-color of the legend box

inset

inset distance(s) from the margins as a fraction of the plot region when legend is placed by keyword.

bias

logical value. If bias = TRUE, it will be drawn a legend for plotBias() function.

model.names

legend names for different models. If NULL the regression type will be used.

...

other parameters of function legend().

Value

Legend in plot.

See Also

plot.mcr, plotBias, plotResiduals, plotDifference, compareFit

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#library("mcr")

 data(creatinine,package="mcr")
 x <- creatinine$serum.crea
 y <- creatinine$plasma.crea

 m1 <- mcreg(x,y,method.reg="Deming", mref.name="serum.crea",
                                        mtest.name="plasma.crea", na.rm=TRUE)
 m2 <- mcreg(x,y,method.reg="WDeming", method.ci="jackknife",
                                         mref.name="serum.crea",
                                         mtest.name="plasma.crea", na.rm=TRUE)

 plot(m1,  XLIM=c(0.5,3),YLIM=c(0.5,3), Legend=FALSE,
                          Title="Deming vs. weighted Deming regression",
                          Points.pch=19,ci.area=TRUE, ci.area.col=grey(0.9),
                          identity=FALSE, Grid=FALSE, Sub="")
 plot(m2, ci.area=FALSE, ci.border=TRUE, ci.border.col="red3",
                          reg.col="red3", Legend=FALSE,add=TRUE,
                          Points=FALSE, identity=FALSE, Grid=FALSE)

 includeLegend(place="topleft",models=list(m1,m2),
                          colors=c("darkblue","red"), design="1", digits=2)

Example output

Please note: 
2 of 110 observations contain missing values and have been removed.
Number of data points in analysis is 108.
Please note: 
2 of 110 observations contain missing values and have been removed.
Number of data points in analysis is 108.
Jackknife based calculation of standard error and confidence intervals according to Linnet's method.
There were 49 warnings (use warnings() to see them)
Warning messages:
1: In plot.xy(xy.coords(x, y), type = type, ...) :
  "Legend" is not a graphical parameter
2: In plot.xy(xy.coords(x, y), type = type, ...) :
  "Points" is not a graphical parameter
3: In plot.xy(xy.coords(x, y), type = type, ...) :
  "Grid" is not a graphical parameter

mcr documentation built on May 30, 2017, 6:15 a.m.