if(require("TDAstats"))
{
# create a sample diagram from the unit circle
df <- TDAstats::circle2d[sample(1:100,50),]
diag <- TDAstats::calculate_homology(df,threshold = 2)
# plot without title
plot_diagram(diag)
# plot with title
plot_diagram(diag,title = "Example diagram")
# determine persistence thresholds
thresholds <- bootstrap_persistence_thresholds(X = df,maxdim = 1,
thresh = 2,num_samples = 3,
num_workers = 2)
# plot with bootstrap persistence thresholds
plot_diagram(diag,title = "Example diagram with thresholds",thresholds = thresholds)
#' # plot with personalized persistence thresholds
plot_diagram(diag,title = "Example diagram with personalized thresholds",thresholds = c(0.5,1))
}
Run the code above in your browser using DataLab