(betti_numbers, samplings, homology_dimensions=None,
                      plotly_params=None)
return fig
Plot Betti curves by homology dimension.

    Parameters
    ----------
    betti_numbers : ndarray of shape (n_homology_dimensions, n_bins)
        Betti numbers, i.e. the y-coordinates of Betti curves. Entry i along
        axis 0 is assumed to contain the Betti numbers for a discretised Betti
        curve in homology dimension i.

    samplings : ndarray of shape (n_homology_dimensions, n_bins)
        Filtration parameter values to be used as the x-coordinates of the
        Betti curves.

    homology_dimensions : list, tuple or None, optional, default: ``None``
        Which homology dimensions to include in the plot. If ``None``,
        all available homology dimensions will be used.

    plotly_params : dict or None, optional, default: ``None``
        Custom parameters to configure the plotly figure. Allowed keys are
        ``"traces"`` and ``"layout"``, and the corresponding values should be
        dictionaries containing keyword arguments as would be fed to the
        :meth:`update_traces` and :meth:`update_layout` methods of
        :class:`plotly.graph_objects.Figure`.

    Returns
    -------
    fig : :class:`plotly.graph_objects.Figure` object
        Figure representing the Betti curves.
Plot Betti curves by homology dimension.
Plot Betti curves by homology dimension .
def plot_betti_curves(betti_numbers, samplings, homology_dimensions=None,
                      plotly_params=None):
    """Plot Betti curves by homology dimension.

    Parameters
    ----------
    betti_numbers : ndarray of shape (n_homology_dimensions, n_bins)
        Betti numbers, i.e. the y-coordinates of Betti curves. Entry i along
        axis 0 is assumed to contain the Betti numbers for a discretised Betti
        curve in homology dimension i.

    samplings : ndarray of shape (n_homology_dimensions, n_bins)
        Filtration parameter values to be used as the x-coordinates of the
        Betti curves.

    homology_dimensions : list, tuple or None, optional, default: ``None``
        Which homology dimensions to include in the plot. If ``None``,
        all available homology dimensions will be used.

    plotly_params : dict or None, optional, default: ``None``
        Custom parameters to configure the plotly figure. Allowed keys are
        ``"traces"`` and ``"layout"``, and the corresponding values should be
        dictionaries containing keyword arguments as would be fed to the
        :meth:`update_traces` and :meth:`update_layout` methods of
        :class:`plotly.graph_objects.Figure`.

    Returns
    -------
    fig : :class:`plotly.graph_objects.Figure` object
        Figure representing the Betti curves.

    """
    if homology_dimensions is None:
        _homology_dimensions = list(range(betti_numbers.shape[0]))
    else:
        _homology_dimensions = homology_dimensions

    layout = {
        "xaxis1": {
            "title": "Filtration parameter",
            "side": "bottom",
            "type": "linear",
            "ticks": "outside",
            "anchor": "x1",
            "showline": True,
            "zeroline": True,
            "showexponent": "all",
            "exponentformat": "e"
            },
        "yaxis1": {
            "title": "Betti number",
            "side": "left",
            "type": "linear",
            "ticks": "outside",
            "anchor": "y1",
            "showline": True,
            "zeroline": True,
            "showexponent": "all",
            "exponentformat": "e"
            },
        "plot_bgcolor": "white"
        }

    fig = gobj.Figure(layout=layout)
    fig.update_xaxes(zeroline=True, linewidth=1, linecolor="black",
                     mirror=False)
    fig.update_yaxes(zeroline=True, linewidth=1, linecolor="black",
                     mirror=False)

    for dim in _homology_dimensions:
        fig.add_trace(gobj.Scatter(x=samplings[dim],
                                   y=betti_numbers[dim],
                                   mode="lines", showlegend=True,
                                   hoverinfo="none",
                                   name=f"H{int(dim)}"))

    # Update traces and layout according to user input
    if plotly_params:
        fig.update_traces(plotly_params.get("traces", None))
        fig.update_layout(plotly_params.get("layout", None))

    return fig
def plot_betti_curves ( betti_numbers , samplings , homology_dimensions = None , plotly_params = None ) : if homology_dimensions is None : _homology_dimensions = list ( range ( betti_numbers . shape [ 0 ] ) ) else : _homology_dimensions = homology_dimensions layout = { "xaxis1" : { "title" : "Filtration parameter" , "side" : "bottom" , "type" : "linear" , "ticks" : "outside" , "anchor" : "x1" , "showline" : True , "zeroline" : True , "showexponent" : "all" , "exponentformat" : "e" } , "yaxis1" : { "title" : "Betti number" , "side" : "left" , "type" : "linear" , "ticks" : "outside" , "anchor" : "y1" , "showline" : True , "zeroline" : True , "showexponent" : "all" , "exponentformat" : "e" } , "plot_bgcolor" : "white" } fig = gobj . Figure ( layout = layout ) fig . update_xaxes ( zeroline = True , linewidth = 1 , linecolor = "black" , mirror = False ) fig . update_yaxes ( zeroline = True , linewidth = 1 , linecolor = "black" , mirror = False ) for dim in _homology_dimensions : fig . add_trace ( gobj . Scatter ( x = samplings [ dim ] , y = betti_numbers [ dim ] , mode = "lines" , showlegend = True , hoverinfo = "none" , name = f"H{int(dim)}" ) ) # Update traces and layout according to user input if plotly_params : fig . update_traces ( plotly_params . get ( "traces" , None ) ) fig . update_layout ( plotly_params . get ( "layout" , None ) ) return fig