if (interactive() && requireNamespace("plotly", quietly = TRUE)) {
# Create sample data and plot
data <- data.frame(
V1 = rnorm(100), V2 = rnorm(100), name=1:100,
antigen = rep(c(0,1), 50), antiserum = rep(c(1,0), 50),
year = rep(2000:2009, each=10), cluster = rep(1:5, each=20)
)
# Create temporal plot
p1 <- plot_temporal_mapping(data, ndim=2)
# Make interactive with default tooltips
p1_interactive <- make_interactive(p1)
# Create cluster plot with custom tooltips
p2 <- plot_cluster_mapping(data, ndim=2)
p2_interactive <- make_interactive(p2,
tooltip_vars = c("cluster", "year", "antigen")
)
}
Run the code above in your browser using DataLab