plot.summaryAlphaPart | R Documentation |
A function to plot summary of partitioned breeding values.
## S3 method for class 'summaryAlphaPart' plot(x, by, sortValue, sortValueFUN, sortValueDec, addSum, paths, xlab, ylab, xlim, ylim, color, lineSize, lineType, lineTypeList, useDirectLabels, method, labelPath, ...)
x |
summaryAlphaPart, object from the |
by |
Character, the name of a column by which summary function
FUN should be applied; if |
sortValue |
Logical, affect legend attributes via sort of paths
according to |
sortValueFUN |
Function, that produces single value for one
vector, say |
sortValueDec |
Logical, sort decreasing. |
addSum |
Logical, plot the overall trend. |
paths |
Character or list or characters, name of paths to plot;
if |
xlab |
Character, x-axis label. |
ylab |
Character, y-axis label; can be a vector of several
labels if there are more traits in |
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
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
|
useDirectLabels |
Logical, use directlabels package for legend. |
method |
List, method for direct.label. |
labelPath |
Character, legend title; used only if
|
... |
Arguments passed to other functions (not used at the moment). |
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.
A list of ggplot objects that can be further modified or
displayed. For each trait in x
there is one plot
visualising summarized values.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.