plot_order_EM_overlay2D.RdGiven an \(n \times 2\) embedding (coords) and a continuous ordering vector
(order_vec), this function bins observations by order_vec (either by
quantiles or equal-width bins) and colors points by the resulting bins. It then overlays
SmoothEM component means (mu_list) as points connected by arrows.
plot_order_EM_overlay2D(
coords,
order_vec,
mu_list,
method = c("auto", "quantiles", "seq"),
probs = seq(0, 1, by = 0.1),
nbins = 30,
include_lowest = TRUE,
right = TRUE,
only = NULL,
fixed_limits = TRUE,
pal = NULL,
pch = 16,
cex = 0.7,
add_centroid = FALSE,
centroid_pch = 4,
centroid_cex = 1.2,
centroid_lwd = 2,
centroid_labels = FALSE,
label_cex = 0.8,
label_pos = 3,
mu_order = NULL,
mu_pch = 8,
mu_col = "orange",
mu_cex = 1,
arrow_col = "orange",
arrow_lwd = 2.5,
arrow_len = 0.08,
add_legend = FALSE,
legend_loc = "none",
legend_cex = 0.7,
legend_title = NULL,
asp = 1,
xlab = "dim1",
ylab = "dim2",
main = "Ordering + EM means",
...
)Numeric matrix of dimension \(n \times 2\).
Numeric vector of length \(n\). Any continuous ordering/score vector.
A length-\(K\) list of mean vectors; each element must have at least 2 entries.
The first two entries are used as coordinates in the same 2D space as coords.
Binning method for order_vec: "quantiles" or "seq".
If "auto", defaults to "seq".
Quantile breakpoints (used when method = "quantiles").
Number of equal-width bins (used when method = "seq").
Passed to cut.
Optional subset of bins to plot; either integer bin indices or bin labels.
Logical; if TRUE, keep xlim/ylim fixed to the full
coords range even when only is used.
Optional vector of colors (length = number of plotted bins). If NULL, a blue-white-red palette is used.
Point style for observations.
Logical; if TRUE, add per-bin centroids (computed on plotted subset).
Centroid styling.
Optional permutation of 1:K controlling the overlay order of mu_list.
Styling for mean points.
Styling for arrows.
Legend controls. Set legend_loc = "none" (or NULL) to suppress legend.
Plot controls passed to plot.
Additional arguments passed to plot.
Invisibly returns a list with kept indices, bins, colors, optional bin centroids, and the plotted mean coordinates.