View source: R/utils_matrix_plot.R
utils_matrix_plot | R Documentation |
This function is a simplified version of fields::imagePlot()
, by Douglas Nychka. The original version is recommended in case more customization than the provided here is needed.
utils_matrix_plot(
m = NULL,
matrix_color = NULL,
title = NULL,
subtitle = NULL,
xlab = NULL,
ylab = NULL,
text_cex = 1,
path = NULL,
path_width = 1,
path_color = "black",
diagonal_width = 1,
diagonal_color = "white",
guide = TRUE,
subpanel = FALSE
)
m |
(required, numeric matrix) distance or cost matrix generated by |
matrix_color |
(optional, character vector) vector of colors. Uses the palette "Zissou 1" by default. Default: NULL |
title |
(optional, character string) plot title. By default, names of the sequences used to compute the matrix |
subtitle |
(optional, character string) plot subtitle. Default: NULL |
xlab |
(optional, character string) title of the x axis (matrix columns). By default, the name of one of the sequences used to compute the matrix |
ylab |
(optional, character string) title of the y axis (matrix rows). By default, the name of one of the sequences used to compute the matrix |
text_cex |
(optional, numeric) multiplicator of the text size for the plot labels and titles. Default: 1 |
path |
(optional, data frame) least cost path generated with |
path_width |
(optional, numeric) width of the least cost path. Default: 1 |
path_color |
(optional, character string) color of the least-cost path. Default: "black" |
diagonal_width |
(optional, numeric) width of the diagonal. Set to 0 to remove the diagonal line. Default: 0.5 |
diagonal_color |
(optional, character string) color of the diagonal. Default: "white" |
guide |
(optional, logical) if TRUE, a color guide for the matrix |
subpanel |
(optional, logical) internal argument used when generating the multi-panel plot produced by |
plot
Other internal_plotting:
color_continuous()
,
color_discrete()
,
utils_color_breaks()
,
utils_line_color()
,
utils_line_guide()
,
utils_matrix_guide()
#prepare time series list
tsl <- tsl_simulate(
n = 2,
independent = TRUE
)
#distance matrix between time series
dm <- psi_distance_matrix(
x = tsl[[1]],
y = tsl[[2]]
)
#cost matrix
cm <- psi_cost_matrix(
dist_matrix = dm
)
#least cost path
cp <- psi_cost_path(
dist_matrix = dm,
cost_matrix = cm
)
#plot cost matrix and least cost path
if(interactive()){
utils_matrix_plot(
m = cm,
path = cp,
guide = TRUE
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.