def ACPlotDiags(pt_cloud, homologyDegree = 1): alpha_complex = gd.AlphaComplex(points=pt_cloud) simplex_tree3 = alpha_complex.create_simplex_tree(max_alpha_square=60.0) diag3 = simplex_tree3.persistence(homology_coeff_field=2, min_persistence=0) gd.plot_persistence_diagram(diag3) diag = simplex_tree3.persistence_intervals_in_dimension(homologyDegree) return diag
def bettiNumbers(self, *args, **kwargs): from gudhi import RipsComplex, plot_persistence_diagram, plot_persistence_barcode, sparsify_point_set import random as r import numpy as np import matplotlib.pyplot as plt targetCluster = kwargs.get('targetCluster', [1]) threshold = kwargs.get('threshold', 0.05) sparsifyThreshold = kwargs.get('sparsifyThreshold', threshold/8) plot = kwargs.get('plot', False) pointList = [] for point in self.points: if point.cluster in targetCluster: pointList.append(np.array(point.coordinates)) pointList = sparsify_point_set( points=pointList, min_squared_dist=sparsifyThreshold**2) point_complex = RipsComplex( max_edge_length=threshold/2, points=pointList) simplex_tree = point_complex.create_simplex_tree( max_dimension=self.dimension) persistence = simplex_tree.persistence() if plot: plot_persistence_barcode(persistence) plt.plot() plot_persistence_diagram(persistence) plt.plot() return simplex_tree.betti_numbers()
def Compute_rhoT(fasta_input,empty_fasta, single_line = False): #fasta file and an empty fasta file print("Reading FASTA file...") if not single_line: single_line_fasta(fasta_input, empty_fasta) fasta_file = empty_fasta else: fasta_file = fasta_input lines = format_data(fasta_file,'fasta') print("Computing Hamming distance matrix...") #print(lines[0:5]) matrix = empty_matrix(lines) hamm_matrix = populate_matrix(matrix, lines) print('Computing barcodes ...') dgms = ripser(hamm_matrix, distance_matrix=True, maxdim=1)['dgms'] Rbarc = dgms Gbarc = Rips_to_GUDHI(Rbarc) print('Plotting persistence diagrams') gd.plot_persistence_diagram(Gbarc, colormap = ('navy','darkmagenta','fuchsia')) gd.plot_persistence_barcode(Gbarc, colormap = ('navy','darkmagenta','fuchsia')) print('Computing barcode statistics...') avg0, var0, b1 = barstats(Rbarc) print('Computing estimate of rho') rhoT = TREErho(avg0, var0, b1) print('$\psi = {}, \Phi = {}, \\beta_1 = {}, \\rho_T = {}$'.format(avg0, var0, b1, rhoT)) return hamm_matrix,Rbarc
def main(): import persistence import matplotlib.pyplot as plt try: import gudhi except: print('gudhi package not installed') return # definir la filtration : on a un triangle vide et un triangle plein qui partagent une arete st = gudhi.SimplexTree() n_pts = 5 time = 0.0 for n in range(n_pts): st.insert([n], time) time += 1.0 for n in range(n_pts - 1, 0, -1): st.insert([0, n], time) time += 1.0 diag = st.persistence(persistence_dim_max=True) gudhi.plot_persistence_diagram(diag) plt.show() diag2 = clean_diag(diag) landscape = persistence.persistence_landscape(diag2) persistence.plot_persistence_landscape(landscape) plt.show()
def persistent_homology( data: np.ndarray, plot: bool = False, tikzplot: bool = False, maxEdgeLength: int = 42, maxDimension: int = 10, maxAlphaSquare: float = 1e12, homologyCoeffField: int = 2, minPersistence: float = 0, filtration: str = ["alphaComplex", "vietorisRips", "tangential"], ): """ **Create persistence diagram.** This function computes the persistent homology of a dataset upon a filtration of a chosen simplicial complex. It can be used for plotting or scientific displaying of persistent homology classes. + param **data**: data, type `np.ndarray`. + param **plot**: whether or not to plot the persistence diagram using matplotlib, type `bool`. + param **tikzplot**: whether or not to create a tikz file from persistent homology, type `bool`. + param **maxEdgeLength**: maximal edge length of simplicial complex, type `int`. + param **maxDimension**: maximal dimension of simplicial complex, type `int`. + param **maxAlphaSquare**: alpha square value for Delaunay complex, type `float`. + param **homologyCoeffField**: integers, cyclic moduli integers, rationals enumerated, type `int`. + param **minPersistence**: minimal persistence of homology class, type `float`. + param **filtration**: the used filtration to calculate persistent homology, type `str`. + return **np.ndarray**: data points, type `np.ndarray`. """ dataShape = data.shape elementSize = len(data[0].flatten()) reshapedData = data[0].reshape((int(elementSize / 2), 2)) if filtration == "vietorisRips": simComplex = gd.RipsComplex( points=reshapedData, max_edge_length=maxEdgeLength).create_simplex_tree( max_dimension=maxDimension) elif filtration == "alphaComplex": simComplex = gd.AlphaComplex(points=reshapedData).create_simplex_tree( max_alpha_square=maxAlphaSquare) elif filtration == "tangential": simComplex = gd.AlphaComplex(points=reshapedData, intrinsic_dimension=len(data.shape) - 1).compute_tangential_complex() persistenceDiagram = simComplex.persistence( homology_coeff_field=homologyCoeffField, min_persistence=minPersistence) if plot == True: gd.plot_persistence_diagram(persistenceDiagram) plt.show() elif tikzplot == True: gd.plot_persistence_diagram(persistenceDiagram) plt.title("Persistence landscape.") tikz.save("persistentHomology_" + filtration + ".tex") return persistenceDiagram
def PlotPersistenceDiagram(st, homology_coeff_field=2): ''' Displays the persistence diagram of the simplex tree st. Input: st (gudhi.SimplexTree). homology_coeff_field (int, optional): Field of coefficients to compute the persistence ''' gudhi.plot_persistence_diagram( st.persistence(homology_coeff_field=homology_coeff_field), colormap=tuple(COLORS))
def get_diagram(self, show=False, path_to_save=None): assert self.simplex_true_computed fig, ax = plt.subplots() diag = self.simplex_tree.persistence() gudhi.plot_persistence_diagram(diag, axes=ax, legend=True) if path_to_save is not None: plt.savefig(path_to_save, dpi=200) if show: plt.show() plt.close()
def TDA_monitoring(params, x_latent): import gudhi distance_matrix = np.arccos(np.clip(np.inner(x_latent,x_latent), -0.99, 0.99)) rips_complex = gudhi.RipsComplex(distance_matrix=distance_matrix) simplex_tree = rips_complex.create_simplex_tree(max_dimension=params.max_dimension) persistent = simplex_tree.persistence() diags = [simplex_tree.persistence_intervals_in_dimension(dim) for dim in range(params.max_dimension)] diags = [np.array([t for t in diag if not math.isinf(t[1])]) for diag in diags] if params.plot: gudhi.plot_persistence_diagram(persistent) plt.show() return diag_entropies(diags[0], mode='vector')
def save_diagram(filename): df = pd.read_csv("../distances/our_distances/" + filename, index_col=0) df = df.to_numpy() rips_complex = gudhi.RipsComplex(distance_matrix=df) simplex_tree = rips_complex.create_simplex_tree(max_dimension=2) # simplex_tree.prune_above_filtration(20) diag = simplex_tree.persistence() # plt.figure(figsize=(10, 5)) gudhi.plot_persistence_diagram(diag) plt.savefig("../diagrams/our_diagrames/" + '.'.join(filename.split('.')[:-1]) + ".png")
def PH_diag(img): z, y, x = img.shape cc = gd.CubicalComplex(dimensions=(z, y, x), top_dimensional_cells=1 - img.flatten()) diag = cc.persistence() plt.figure(figsize=(3, 3)) gd.plot_persistence_barcode(diag, max_intervals=0, inf_delta=100) plt.xlim(0, 1) plt.ylim(-1, len(diag)) plt.xticks(ticks=np.linspace(0, 1, 6), labels=np.round(np.linspace(1, 0, 6), 2)) plt.yticks([]) plt.show() gd.plot_persistence_diagram(diag, legend=True) plt.show() gd.plot_persistence_density(diag, legend=True) plt.show()
def rips__filtration_gudhi(D, p, coeff=2, doPlot=False): """ Do the rips filtration, wrapping around the GUDHI library (for comparison) :param X: An Nxk matrix of points :param p: The order of homology to go up to :param coeff: The field coefficient of homology :returns Is: A dictionary of persistence diagrams, where Is[k] is \ the persistence diagram for Hk """ import gudhi rips = gudhi.RipsComplex(distance_matrix=D, max_edge_length=np.inf) simplex_tree = rips.create_simplex_tree(max_dimension=p + 1) diag = simplex_tree.persistence(homology_coeff_field=coeff, min_persistence=0) if doPlot: pplot = gudhi.plot_persistence_diagram(diag) pplot.show() Is = [] for i in range(p + 1): Is.append([]) for (i, (b, d)) in diag: Is[i].append([b, d]) for i in range(len(Is)): Is[i] = np.array(Is[i]) return Is
def compute_persistence(self, distances, dimension = 2, spy = False): """ Function for computing the persistent homology from the given distance matrix. Once the birth and death times are calculated, we look at the difference between the lifetimes of two longest living cycles of given dimension as well as the lifetimes of longest and shortest living cycles which should recover the `self.manifold`. Parameters ============ distances: array , `self.N x self.N` Distance matrix obtained from `make_distance_matrix`. dimension: int Maximum dimension that the simplicial complex will be built. Accordingly, maximum dimensional topological features are going to be `dimension -1`. Default is 2 suitable for the `Ring` topology, which is a 1-D compact manifold, but should set to 3 if the topology is a 2D-compact manifold. spy: bool If True, persistence diagram will be shown. Returns =========== Delta_min: float Normalized difference between the lifetimes of longest and and second longest living cycles of dimension `dimension -1`. Delta_max: float Normalized difference between the lifetimes of longest and shorthes living cycles of dimension `dimension -1`. """ rips_complex = gudhi.RipsComplex(distance_matrix = distances/np.max(distances), max_edge_length = 1) simplex_tree = rips_complex.create_simplex_tree(max_dimension = dimension) persistence = simplex_tree.persistence(min_persistence = 0.0) if spy: gudhi.plot_persistence_diagram(persistence) oned_holes = [(0,0)] for i in range(len(persistence)): if persistence[i][0] == int(dimension-1): oned_holes.append(persistence[i][1]) oned_holes = np.array(oned_holes) persistence_life_times = oned_holes[:,1]-oned_holes[:,0] Delta_min = np.sort(persistence_life_times)[-1]-np.sort(persistence_life_times)[-2] Delta_max = np.sort(persistence_life_times)[-1]-np.sort(persistence_life_times)[1] return(Delta_min, Delta_max)
def PH_diag(img, patch_side): cc = gd.CubicalComplex(dimensions=(patch_side, patch_side, patch_side), top_dimensional_cells=1 - img.flatten()) diag = cc.persistence() plt.figure(figsize=(3, 3)) diag_clean = diag_tidy(diag, 1e-3) gd.plot_persistence_barcode(diag_clean, max_intervals=0,inf_delta=10) print(diag_clean) plt.xlim(0, 1) plt.ylim(-1, len(diag_clean)) plt.xticks(ticks=np.linspace(0, 1, 6), labels=np.round(np.linspace(1, 0, 6), 2)) plt.yticks([]) plt.show() gd.plot_persistence_diagram(diag_clean, legend=True) plt.show() gd.plot_persistence_density(diag, legend=True) plt.show()
def draw(self, betti=True): diag = self.simplex_tree.persistence(persistence_dim_max=True) if betti: print("Betti numbers [b_0, b_1, ...] = " + str(self.simplex_tree.betti_numbers())) ax = gudhi.plot_persistence_diagram(diag, legend=True) ax.set_title("Persistence diagram") ax.set_aspect("equal") plt.show()
def visualise(self, w_size, end_date=None, save='') -> None: """" plot persistence and its landscape Parameters: end_date: the last day used to compute persistence graphs w_size: size of the windows for the landscapes computations Returns: None """ if self.fig is None: self.fig = plt.figure('Persistence graphs', figsize=(12, 6)) self.fig.tight_layout() self.fig.subplots_adjust(left=0.08, right=0.97, top=0.9, bottom=0.1) self.ax1 = self.fig.add_subplot(1, 2, 1) self.ax2 = self.fig.add_subplot(1, 2, 2) self.ax2.set_title('Persistence landscape') self.ax2.set_xlabel(r'$\frac{d+b}{2}$') self.ax2.set_ylabel(r'$\frac{d-b}{2}$') self.ax2.yaxis.set_major_formatter( mtick.FormatStrFormatter('%.1e')) else: self.ax1.cla() self.ax2.lines = [] diagram, land = self.__call__(w_size, end_date) gd.plot_persistence_diagram(diagram, axes=self.ax1) self.ax2.plot(land[0]) sys.stdout.write(f'Plot Persistence graphs\n') sys.stdout.flush() plt.draw() if save: self.fig.savefig(save) plt.pause(0.001) input("Press [enter] to continue.")
def get_persistence_from_audio(audio_wave, sample=22050, length=5, graph=False): simplex_up = gd.SimplexTree() # for the upper level persistence data simplex_dw = gd.SimplexTree() # for the lower level persistence data for i in np.arange(len(audio_wave)): simplex_up.insert([i, i + 1], filtration=audio_wave[i]) simplex_dw.insert([i, i + 1], filtration=-audio_wave[i]) for i in np.arange(len(audio_wave) - 1): simplex_up.insert([i, i + 1], filtration=audio_wave[i]) simplex_dw.insert([i, i + 1], filtration=-audio_wave[i]) simplex_up.initialize_filtration() simplex_dw.initialize_filtration() dig_up = simplex_up.persistence() dig_dw = simplex_dw.persistence() if graph: plt.figure() lr_disp.waveplot(audio_wave, sr=sample) plt.title("Audio Wave") plt.show() plt.figure() gd.plot_persistence_barcode(dig_up) plt.title("Upper Level Persistence Barcode") plt.show() plt.figure() gd.plot_persistence_barcode(dig_dw) plt.title("Sub Levels Persistence Barcode") plt.show() plt.figure() gd.plot_persistence_diagram(dig_up) plt.title("Upper Level Persistence Diagram") plt.show() plt.figure() gd.plot_persistence_diagram(dig_dw) plt.title("Sub Levels Persistence Diagram") plt.show() return dig_up, dig_dw # NOTE: this does not filter out infinite values
def compute_persistence(self, distances, spy = False): """ Helper to compute persistent homology using the distance matrix by building a Rips filtration up to dimension 2(topological features to be observed are going to be 1 dimensional at max). First normalizes the distances before the computation. Parameters ---------- distances: n x n array distance matrix. First output of the make_distance_matrix. spy: bool, optional Take a peak at the persistence diagram Returns ------- diag: list The birth and death times of the topological features in all dimensions. """ rips_complex = gudhi.RipsComplex(distance_matrix = distances/np.max(distances), max_edge_length = 1) simplex_tree = rips_complex.create_simplex_tree(max_dimension = 2) diag = simplex_tree.persistence(min_persistence = 0.0) if spy: gudhi.plot_persistence_diagram(diag) return(diag)
def doRipsFiltrationDMGUDHI(D, maxHomDim, coeff=2, doPlot=False): import gudhi rips = gudhi.RipsComplex(distance_matrix=D, max_edge_length=np.inf) simplex_tree = rips.create_simplex_tree(max_dimension=maxHomDim + 1) diag = simplex_tree.persistence(homology_coeff_field=coeff, min_persistence=0) if doPlot: pplot = gudhi.plot_persistence_diagram(diag) pplot.show() Is = [] for i in range(maxHomDim + 1): Is.append([]) for (i, (b, d)) in diag: Is[i].append([b, d]) for i in range(len(Is)): Is[i] = np.array(Is[i]) return Is
def save_persistences(self, labels, out_dir): """Saves the persistence diagrams to file. Requires persistence to be called first. Parameters ---------- out_dir : str, path to directory where the diagrams are saved. """ for i, diag in enumerate(self.persistences): fig = gd.plot_persistence_diagram(diag) plt.title(labels[i]) file_path = os.path.join(out_dir, 'persistence-{}.png'.format(i)) plt.savefig(file_path, bbox_inches='tight') plt.close()
def tgtDtmPdFromTimeSeries(tgtTimeSeries, pcDim, homDim, maxEdgeLen, kNN, tdeSkip = 1, tdeDelay = 1): #homDim is a list indicating which homology dimensions are being considered. pcPts = convertTde(tgtTimeSeries, skip = tdeSkip, delay = tdeDelay, dimension = pcDim) #create point cloud (PC) for time series print("tgtDtmPdFromTimeSeries: no. of points "), print(pcPts.shape) #Build DTM based filtration dtmValues = DTM(pcPts,pcPts,kNN) distances = EuclideanDistances(pcPts) simplex_tree = StructureW(pcPts,dtmValues,distances,edge_max=maxEdgeLen) #PD of the target PC diag = simplex_tree.persistence(homology_coeff_field=2, min_persistence=0) diagPlt = gd.plot_persistence_diagram(diag) #diagPlt.axis('equal') diagPlt.show() tgtPD = [] #target PD is a list of tuples, same as Gudhi format. maxPers = 0 maxInd = 0 dimZeroCnt = 0 for iDiag in diag: if (iDiag[0] in homDim): if (iDiag[0] == 0): dimZeroCnt += 1 birthTime = iDiag[1][0] deathTime = iDiag[1][1] if (np.isinf(deathTime)): deathTime = maxEdgeLen tgtPD.append((iDiag[0],(birthTime,deathTime))) print("No. of points in target PD %d, no. of zero dimensional points %d" % (len(tgtPD), dimZeroCnt)) return tgtPD
def plot_persistence(data, cols, max_edge_length=5, max_dimension=5, save=False): rips_complex = gudhi.RipsComplex(points=data, max_edge_length=max_edge_length) simplex_tree = rips_complex.create_simplex_tree( max_dimension=max_dimension) print('Dimension of Rips complex: {}\nNumber of vertices: {}\nNumber of simplices: {}'.\ format(simplex_tree.dimension(), simplex_tree.num_vertices(), simplex_tree.num_simplices())) #for filtered_value in simplex_tree.get_filtration(): #print(tuple(filtered_value)) diag = simplex_tree.persistence(homology_coeff_field=2, min_persistence=0) #print('diag = {}'.format(diag)) pplot = gudhi.plot_persistence_diagram(diag) pplot.savefig(fname(cols, 0, max_edge_length, max_dimension)) pplot.show() diag = diagram2array(diag) np.savetxt(fname(cols, 1, max_edge_length, max_dimension), diag) print diag return diag
points=witnesses, nb_points=args.number_of_landmarks) message = ("EuclideanWitnessComplex with max_edge_length=" + repr(args.max_alpha_square) + " - Number of landmarks=" + repr(args.number_of_landmarks)) print(message) witness_complex = gudhi.EuclideanWitnessComplex(witnesses=witnesses, landmarks=landmarks) simplex_tree = witness_complex.create_simplex_tree( max_alpha_square=args.max_alpha_square, limit_dimension=args.limit_dimension) message = "Number of simplices=" + repr(simplex_tree.num_simplices()) print(message) diag = simplex_tree.persistence() print("betti_numbers()=") print(simplex_tree.betti_numbers()) if args.no_diagram == False: import matplotlib.pyplot as plot gudhi.plot_persistence_diagram(diag, band=args.band) plot.show() else: raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), args.file) f.close()
st.insert([ind, ind + 1, ind + width + 1], max_value([ind, ind + 1, ind + width + 1])) count += 1 st.insert([ind, ind + width, ind + width + 1], max_value([ind, ind + width, ind + width + 1])) count += 1 # pdb.set_trace() print(count, "counts") return st # return s st = init_freudenthal_2d(w, h) result_str = 'num_vertices=' + repr(st.num_vertices()) print(result_str) result_str = 'num_simplices=' + repr(st.num_simplices()) print(result_str) print("skeleton(2) =") for sk_value in st.get_skeleton(2): print(sk_value) if st.make_filtration_non_decreasing(): print("modefied filtration value") st.initialize_filtration() for i in st.persistence(): print(i) graph_persistence = st.persistence() gudhi.plot_persistence_diagram(graph_persistence, legend=True) plt.show()
import scipy as sp import scipy.spatial as spt import seaborn as sns from sklearn import manifold '''### Compute persistence diagrams ############################################################''' corr_protein_1 = pd. read_csv(f'{dataDir}/1anf.corr_1.txt', header=None, delim_whitespace=True ) # corr_protein_1.head() dist_protein_1 = 1 - np.abs( corr_protein_1.values ) rips_complex_1 = gd.RipsComplex(distance_matrix=dist_protein_1, max_edge_length =1.1) simplex_tree_1 = rips_complex_1.create_simplex_tree(max_dimension=2) diag_1 = simplex_tree_1.persistence() gd.plot_persistence_diagram(diag_1) '''### Compare persistence diagrams using bottleneck distance ###############''' # 0-homologies interv0_1 = simplex_tree_1.persistence_intervals_in_dimension(0) interv0_2 = simplex_tree_2.persistence_intervals_in_dimension(0) bot0 = gd.bottleneck_distance( interv0_1, interv0_2 ) # 1-homologies interv1_1 = simplex_tree_1.persistence_intervals_in_dimension(1) interv1_2 = simplex_tree_2.persistence_intervals_in_dimension(1) bot1 = gd.bottleneck_distance( interv1_1 , interv1_2 ) mds = manifold.MDS( n_components=2, dissimilarity="precomputed") config = mds.fit(M).embedding_
from sklearn.neighbors.kde import KernelDensity f = open("crater_tuto") #For python 3 #crater = pickle.load(f,encoding='latin1') #For python 2 crater = pickle.load(f) f.close() plt.scatter(crater[:, 0], crater[:, 1], s=0.1) plt.show() #create 10 by 10 cubical complex: xval = np.arange(0, 10, 0.05) yval = np.arange(0, 10, 0.05) nx = len(xval) ny = len(yval) #Now we compute the values of the kernel density estimator on the center of each point of our grid. #The values will be stored in the array scores. kde = KernelDensity(kernel='gaussian', bandwidth=0.3).fit(crater) positions = np.array([[u, v] for u in xval for v in yval]) scores = -np.exp(kde.score_samples(X=positions)) #And subsequently construct a cubical complex based on the scores. cc_density_crater = gd.CubicalComplex(dimensions=[nx, ny], top_dimensional_cells=scores) # OPTIONAL pers_density_crater = cc_density_crater.persistence() plt = gd.plot_persistence_diagram(pers_density_crater).show()
def barcode_plot(pd): plt = gudhi.plot_persistence_diagram(persistence=pd, legend=True) plt.show()
#convert it from multi dimensional array to one dimensional array: data = data[:, 0] #in order to make the computations feasible, we should restrict the data a bit. #experiment with various ranges, do not make it too large unless you want to restart #your computer :) #data = data[0:700] #data = data[700:1500] data = data[000:700] values = data.astype(np.float) #Size of the sliding window. We will try to set it close to the predicted value of period, which is in this case, the number of days in a year. N = 100 swe = [] for i in range(0, len(values) - N): point = [] for j in range(0, N): point.append(values[i + j]) swe.append(point) #Now we have the point cloud, and we can compute the persistent homology in dimension 1: rips_complex = gd.RipsComplex(points=swe, max_edge_length=60) simplex_tree = rips_complex.create_simplex_tree(max_dimension=2) persistence = simplex_tree.persistence() simplex_tree.persistence_intervals_in_dimension(1) plt = gd.plot_persistence_diagram(persistence) plt.show()
import gudhi import math as m import matplotlib.pyplot as plt L = [] for k in range(10): angle = 2 * m.pi * k / 10 L.append([m.cos(angle), m.sin(angle)]) alpha = gudhi.AlphaComplex(points=L) simplex = alpha.create_simplex_tree() diag = simplex.persistence() gudhi.plot_persistence_barcode(diag) gudhi.plot_persistence_diagram(diag) plt.show()
def plot_persistence_diagram(self, *args, **kwargs): ax = gudhi.plot_persistence_diagram(self.persistence, *args, **kwargs)
persistence = [ (2, (1.0, float("inf"))), (1, (1.4142135623730951, float("inf"))), (1, (1.4142135623730951, float("inf"))), (0, (0.0, float("inf"))), (0, (0.0, 1.0)), (0, (0.0, 1.0)), (0, (0.0, 1.0)), ] gudhi.plot_persistence_barcode(persistence) plot.show() print("#####################################################################") print("Show diagram persistence example") gudhi.plot_persistence_diagram(persistence) plot.show() print("#####################################################################") print("Show diagram persistence example with a confidence band") gudhi.plot_persistence_diagram(persistence, band=0.2) plot.show() print("#####################################################################") print("Show barcode and diagram persistence side by side example") fig, axes = plot.subplots(nrows=1, ncols=2) gudhi.plot_persistence_barcode(persistence, axes = axes[0]) gudhi.plot_persistence_diagram(persistence, axes = axes[1]) fig.suptitle("barcode versus diagram") plot.show()