# Basic usage with default configurations
data <- data.frame(
V1 = rnorm(100), V2 = rnorm(100), V3 = rnorm(100), name = 1:100,
antigen = rep(c(0,1), 50), antiserum = rep(c(1,0), 50),
cluster = rep(1:5, each=20)
)
p1 <- plot_cluster_mapping(data, ndim=3)
# Save plot to a temporary directory
temp_dir <- tempdir()
# Custom configurations with specific color palette and axis limits
aesthetic_config <- new_aesthetic_config(
point_size = 4,
point_alpha = 0.7,
color_palette = c("red", "blue", "green", "purple", "orange"),
show_labels = TRUE,
label_size = 3
)
layout_config_save <- new_layout_config(save_plot = TRUE,
width = 10,
height = 8,
coord_type = "fixed",
show_grid = TRUE,
grid_type = "major",
x_limits = c(-10, 10),
y_limits = c(-8, 8)
)
p_saved <- plot_cluster_mapping(data, ndim=3,
layout_config = layout_config_save,
aesthetic_config = aesthetic_config,
output_dir = temp_dir
)
list.files(temp_dir)
unlink(temp_dir, recursive = TRUE)
Run the code above in your browser using DataLab