plot.summaryAlphaPart: plot.summaryAlphaPart.R

Description Usage Arguments Details Value Examples

Description

A function to plot summary of partitioned breeding values.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## S3 method for class 'summaryAlphaPart'
plot(
  x,
  sortValue = TRUE,
  sortValueFUN = sum,
  sortValueDec = TRUE,
  addSum = TRUE,
  paths = NULL,
  xlab = NULL,
  ylab = NULL,
  xlim = NULL,
  ylim = NULL,
  color,
  lineSize = 1,
  lineType = 1,
  lineTypeList = NULL,
  useDirectLabels = TRUE,
  method = list(last.qp, hjust = 0),
  labelPath = NULL,
  ...
)

Arguments

x

summaryAlphaPart, object from the AlphaPart(...) or summary(AlphaPart(...), ...) call.

sortValue

Logical, affect legend attributes via sort of paths according to sortValueFUN function; if not logical, then ordered paths are given as a character vector.

sortValueFUN

Function, that produces single value for one vector, say mean or sum.

sortValueDec

Logical, sort decreasing.

addSum

Logical, plot the overall trend.

paths

Character or list or characters, name of paths to plot; if NULL plot all paths; see examples.

xlab

Character, x-axis label.

ylab

Character, y-axis label; can be a vector of several labels if there are more traits in x (recycled!).

xlim

Numeric, a vector of two values with x-axis limits; use a list of vectors for more traits.

ylim

Numeric, a vector of two values with y-axis limits; use a list of vectors for more traits.

color

Character, color names; by default a set of 54 colors is predefined from the RColorBrewer package; in addition a black colour is attached at the begining for the overall trend; if there are more paths than colors then recycling occours.

lineSize

Numeric, line width.

lineType

Numeric, line type (recycled); can be used only if lineTypeList=NULL.

lineTypeList

List, named list of numeric values that help to point out a set of paths (distinguished with line type) within upper level of paths (distinguished by, color), e.g., lineTypeList=list("-1"=1, "-2"=2, def=1) will lead to use of line type 1 for paths having "-1" at the end of path name and line type 2, for paths having "-2" at the end of path name, while line type 1 (default) will, be used for other paths; specification of this argument also causes recycling of colors for the upper level of paths; if NULL all lines have a standard line type, otherwise lineType does not have any effect.

useDirectLabels

Logical, use directlabels package for legend.

method

List, method for direct.label.

labelPath

Character, legend title; used only if useDirectLabels=FALSE.

...

Arguments passed to other functions (not used at the moment).

Details

Information in summaries of partitions of breeding values can be overhelming due to a large volume of numbers. Plot method can be used to visualise this data in eye pleasing way using ggplot2 graphics.

Value

A list of ggplot objects that can be further modified or displayed. For each trait in x there is one plot visualising summarized values.

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
31
32
33
34
35
## Partition additive genetic values by country
(res <- AlphaPart(x=AlphaPart.ped, colPath="country", colBV=c("bv1", "bv2")))

## Summarize population by generation (=trend)
(ret <- summary(res, by="gen"))

## Plot the partitions
p <- plot(ret, ylab=c("bv for trait 1", "bv for trait 2"), xlab="Generation")
print(p[[1]]$abs)
print(p[[2]]$abs)
print(p)

## Partition additive genetic values by country and sex
AlphaPart.ped$country.gender <- with(AlphaPart.ped, paste(country, gender, sep="-"))
(res <- AlphaPart(x=AlphaPart.ped, colPath="country.gender", colBV=c("bv1", "bv2")))

## Summarize population by generation (=trend)
(ret <- summary(res, by="gen"))

## Plot the partitions
p <- plot(ret, ylab=c("BV for trait 1", "BV for trait 2"), xlab="Generation")
print(p)
p <- plot(ret, ylab=c("BV for trait 1", "BV for trait 2"), xlab="Generation",
        lineTypeList=list("-1"=1, "-2"=2, def=3))
print(p)
p <- plot(ret, ylab=c("BV for trait 1", "BV for trait 2"), xlab="Generation",
        lineTypeList=list("-1"=1, "-2"=2, def=3), useGgplot2=FALSE, useDirectLabels = FALSE)
print(p)

## Plot control (color and type of lines + limits)
p <- plot(ret, ylab=c("BV for trait 1", "BV for trait 2"), xlab="Generation",
        useGgplot2=TRUE, color=c("green", "gray"), lineType=c(2, 3),
        sortValue=FALSE, lineSize=4,
        xlim=c(-1, 7))
print(p)

AlphaPart documentation built on March 25, 2020, 5:13 p.m.