View source: R/scatter_dist_g.R
scatter_dist_g | R Documentation |
The function enables to plot scatterplots of the relationship between two distances (often a genetic distance and a landscape distance between populations or sample sites), while highlighting the population pairs between which a link was conserved during the creation of a graph whose nodes are populations (or sample sites). It thereby allows to visualize the graph pruning intensity.
scatter_dist_g( mat_y, mat_x, graph, thr_y = NULL, thr_x = NULL, pts_col_1 = "#999999", pts_col_2 = "black" )
mat_y |
A symmetric (complete) |
mat_x |
A symmetric (complete) |
graph |
A graph object of class |
thr_y |
(optional) A numeric or integer value used to remove values
from the data before to plot. All values from |
thr_x |
(optional) A numeric or integer value used to remove values
from the data before to plot. All values from |
pts_col_1 |
(optional) A character string indicating the color used to plot the points associated to all populations or sample sites pairs (default: "#999999"). It must be a hexadecimal color code or a color used by default in R. |
pts_col_2 |
(optional) A character string indicating the color used to plot the points associated to populations or sample sites pairs connected on the graph (default: "black"). It must be a hexadecimal color code or a color used by default in R. |
IDs in mat_y
and mat_x
must be the same and refer
to the same sampling sites or populations, and both matrices must be ordered
in the same way.
Matrices of genetic distance can be computed using
mat_gen_dist
.
Matrices of landscape distance can be computed using
mat_geo_dist
when the landscape distance needed is a
Euclidean geographical distance.
This function is based upon scatter_dist
function.
A ggplot2 object to plot
P. Savary
data(data_tuto) mat_gen <- data_tuto[[1]] mat_dist <- suppressWarnings(mat_geo_dist(data=pts_pop_simul, ID = "ID", x = "x", y = "y")) mat_dist <- mat_dist[order(as.character(row.names(mat_dist))), order(as.character(colnames(mat_dist)))] x <- gen_graph_topo(mat_w = mat_gen, mat_topo = mat_dist, topo = "gabriel") scat <- scatter_dist_g(mat_y = mat_gen, mat_x = mat_dist, graph = x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.