Description Usage Arguments Value Examples
Plots the output matrices of distanceMatrix
and leastCostMatrix
, and superimposes the least cost path generated by leastCostPath
. This functions relies on image.plot
to plot a color scale along with the matrix plot, or image
when a color scale is not needed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
distance.matrix |
numeric matrix or list of numeric matrices either produced by |
least.cost.path |
dataframe or list of fdataframes produced by |
plot.columns |
number of columns of the output plot if the inputs are lists. If not provided, it is computed automatically by |
plot.rows |
number of rows of the output plot if the inputs are lists. If not provided, it is computed automatically by |
legend |
boolean. If |
color.palette |
string defining the color palette to be used, or a color palette. Accepted strings are "divergent" (default), which uses a red-white-blue divergent palette produced by the code |
path.color |
string, color of the line representing the least cost path if |
path.width |
line width (lwd) of the plotted path. |
margins |
a numeric vector with four positions indicating the margins of each plotted matrix. Order of margins in this vector is: bottom, left, top, right. |
pdf.filename |
character string with the name, without extension, of the pdf to be written. If |
pdf.width |
with in inches of the output pdf. Default value is 7. |
pdf.height |
height in inches of the output pdf. Default value is 4. |
pdf.pointsize |
base font size of the output pdf. |
rotate |
boolean, if |
A list of dataframes if least.cost.matrix
is a list, or a dataframe if least.cost.matrix
is a matrix. The dataframe/s have the following columns:
A row/sample of one of the sequences.
B row/sample of one the other sequence.
distance distance between both samples, extracted from distance.matrix
.
cumulative.distance cumulative distance at the samples A
and B
.
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 | #loading data
data(sequenceA)
data(sequenceB)
#preparing datasets
AB.sequences <- prepareSequences(
sequence.A = sequenceA,
sequence.A.name = "A",
sequence.B = sequenceB,
sequence.B.name = "B",
merge.mode = "complete",
if.empty.cases = "zero",
transformation = "hellinger"
)
#computing distance matrix
AB.distance.matrix <- distanceMatrix(
sequences = AB.sequences,
grouping.column = "id",
method = "manhattan",
parallel.execution = FALSE
)
#plot
plotMatrix(distance.matrix = AB.distance.matrix)
#viridis palette
plotMatrix(distance.matrix = AB.distance.matrix,
color.palette = "viridis")
#custom palette
plotMatrix(distance.matrix = AB.distance.matrix,
color.palette = viridis::viridis(8, option = "B", direction = -1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.