plotComponent {cfda} | R Documentation |
Plot Components
Description
Plot Components
Usage
plotComponent(
x,
comp = c(1, 2),
addNames = TRUE,
nudge_x = 0.1,
nudge_y = 0.1,
size = 4,
...
)
Arguments
x |
output of |
comp |
a vector of two elements indicating the components to plot |
addNames |
if TRUE, add the id labels on the plot |
nudge_x , nudge_y |
horizontal and vertical adjustment to nudge labels by |
size |
size of labels |
... |
|
Value
a ggplot
object that can be modified using ggplot2
package.
Author(s)
Quentin Grimonprez
See Also
Other encoding functions:
compute_optimal_encoding()
,
get_encoding()
,
plot.fmca()
,
plotEigenvalues()
,
predict.fmca()
,
print.fmca()
,
summary.fmca()
Examples
# Simulate the Jukes-Cantor model of nucleotide replacement
K <- 4
Tmax <- 6
PJK <- matrix(1 / 3, nrow = K, ncol = K) - diag(rep(1 / 3, K))
lambda_PJK <- c(1, 1, 1, 1)
d_JK <- generate_Markov(n = 10, K = K, P = PJK, lambda = lambda_PJK, Tmax = Tmax)
d_JK2 <- cut_data(d_JK, Tmax)
# create basis object
m <- 6
b <- create.bspline.basis(c(0, Tmax), nbasis = m, norder = 4)
# compute encoding
encoding <- compute_optimal_encoding(d_JK2, b, computeCI = FALSE, nCores = 1)
plotComponent(encoding, comp = c(1, 2))
# modify the plot using ggplot2
library(ggplot2)
plotComponent(encoding, comp = c(1, 2), shape = 23) +
labs(title = "Two first components")
[Package cfda version 0.11.0 Index]