This function creates comprehensive visualizations of PCA trajectories over time, showing both individual and group-averaged trajectories with optional smoothing.
plot_pca_trajectories_general(
pca_results,
pc_x = "PC1",
pc_y = "PC2",
trajectory_grouping = NULL,
timepoint_var = "Timepoint",
timepoint_order = NULL,
individual_var = "Experiment",
point_size = 3,
alpha = 0.7,
line_size = 2,
smooth_lines = FALSE,
color_palette = NULL,
save_plots = FALSE,
output_dir = NULL,
plot_prefix = "PCA_trajectories",
width = 12,
height = 8,
dpi = 150,
return_list = TRUE,
verbose = TRUE
)A list containing plots, trajectories, and metadata
A data frame or list containing PCA results
Character string specifying the principal component for x-axis (default: "PC1")
Character string specifying the principal component for y-axis (default: "PC2")
Character vector of column names for grouping trajectories
Character string specifying the timepoint column (default: "Timepoint")
Character vector specifying the order of timepoints
Character string for individual trajectory identification (default: "Experiment")
Numeric value controlling point size (default: 3)
Numeric value controlling transparency (default: 0.7)
Numeric value controlling line thickness (default: 2)
Logical indicating whether to apply smoothing (default: FALSE)
Character vector of colors for groups
Logical indicating whether to save plots (default: FALSE)
Character string specifying output directory (default: NULL)
Character string prefix for filenames (default: "PCA_trajectories")
Numeric plot width in inches (default: 12)
Numeric plot height in inches (default: 8)
Numeric plot resolution (default: 150)
Logical indicating whether to return results as list (default: TRUE)
Logical indicating whether to print messages (default: TRUE)