# Buggy code
def plot(self, Xt, sample=0, homology_dimensions=None, plotly_params=None):
    """Plot a sample from a collection of silhouettes arranged as in
    the output of :meth:`transform`. Include homology in multiple
    dimensions.

    Parameters
    ----------
    Xt : ndarray of shape (n_samples, n_homology_dimensions, n_bins)
        Collection of silhouettes, such as returned by :meth:`transform`.

    sample : int, optional, default: ``0``
        Index of the sample in `Xt` to be plotted.

    homology_dimensions : list, tuple or None, optional, default: ``None``
        Which homology dimensions to include in the plot. ``None`` means
        plotting all dimensions present in :attr:`homology_dimensions_`.

    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
        Plotly figure.

    """
    check_is_fitted(self)

    if homology_dimensions is None:
        _homology_dimensions = list(enumerate(self.homology_dimensions_))
    else:
        _homology_dimensions = []
        for dim in homology_dimensions:
            if dim not in self.homology_dimensions_:
                raise ValueError(
                    f"All homology dimensions must be in "
                    f"self.homology_dimensions_ which is "
                    f"{self.homology_dimensions_}. {dim} is not."
                )
            else:
                homology_dimensions_arr = np.array(self.homology_dimensions_)
                ix = np.flatnonzero(homology_dimensions_arr == dim)[0]
                _homology_dimensions.append((ix, dim))

    layout = {
        "xaxis1": {
            "title": "Filtration parameter",
            "side": "bottom",
            "type": "linear",
            "ticks": "outside",
            "anchor": "x1",
            "showline": True,
            "zeroline": True,
            "showexponent": "all",
            "exponentformat": "e",
        },
        "yaxis1": {
            "side": "left",
            "type": "linear",
            "ticks": "outside",
            "anchor": "y1",
            "showline": True,
            "zeroline": True,
            "showexponent": "all",
            "exponentformat": "e",
        },
        "plot_bgcolor": "white",
        "title": f"Silhouette representation of diagram {sample}",
    }

    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 ix, dim in _homology_dimensions:
        fig.add_trace(
            gobj.Scatter(
                x=self.samplings_[dim],
                y=Xt[sample][ix],
                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


# Traceback (TypeError)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-5e233492b878> in <module>
----> 1 Amplitude(metric="persistence_image").fit_transform(Xd)

~\Workspace\giotto-tda_ulupo\gtda\utils\_docs.py in fit_transform_wrapper(*args, **kwargs)
104         @wraps(original_fit_transform)
105         def fit_transform_wrapper(*args, **kwargs):
--> 106             return original_fit_transform(*args, **kwargs)
107         fit_transform_wrapper.__doc__ = \
108             make_fit_transform_docs(fit_docs, transform_docs)

~\Anaconda3\envs\gtda-ulupo-py38\lib\site-packages\sklearn\base.py in fit_transform(self, X, y, **fit_params)
688         if y is None:
689             # fit method of arity 1 (unsupervised transformation)
--> 690             return self.fit(X, **fit_params).transform(X)
691         else:
692             # fit method of arity 2 (supervised transformation)

~\Workspace\giotto-tda_ulupo\gtda\diagrams\features.py in fit(self, X, y)
273         if self.metric == 'persistence_image':
274             self.effective_metric_params_['weights'] = \
--> 275                 _calculate_weights(X, **self.effective_metric_params_)
276
277         return self

TypeError: _calculate_weights() missing 1 required positional argument: 'weight_function'

# Fixed code
def plot(self, Xt, sample=0, homology_dimensions=None, plotly_params=None):
    """Plot a sample from a collection of silhouettes arranged as in the
    output of :meth:`transform`. Include homology in multiple dimensions.

    Parameters
    ----------
    Xt : ndarray of shape (n_samples, n_homology_dimensions, n_bins)
        Collection of silhouettes, such as returned by :meth:`transform`.

    sample : int, optional, default: ``0``
        Index of the sample in `Xt` to be plotted.

    homology_dimensions : list, tuple or None, optional, default: ``None``
        Which homology dimensions to include in the plot. ``None`` means
        plotting all dimensions present in :attr:`homology_dimensions_`.

    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
        Plotly figure.

    """
    check_is_fitted(self)

    homology_dimensions_mapping = _make_homology_dimensions_mapping(
        homology_dimensions, self.homology_dimensions_
    )

    layout_axes_common = {
        "type": "linear",
        "ticks": "outside",
        "showline": True,
        "zeroline": True,
        "linewidth": 1,
        "linecolor": "black",
        "mirror": False,
        "showexponent": "all",
        "exponentformat": "e",
    }
    layout = {
        "xaxis1": {
            "title": "Filtration parameter",
            "side": "bottom",
            "anchor": "y1",
            **layout_axes_common,
        },
        "yaxis1": {"side": "left", "anchor": "x1", **layout_axes_common},
        "plot_bgcolor": "white",
        "title": f"Silhouette representation of diagram {sample}",
    }

    fig = Figure(layout=layout)

    for ix, dim in homology_dimensions_mapping:
        fig.add_trace(
            Scatter(
                x=self.samplings_[dim],
                y=Xt[sample][ix],
                mode="lines",
                showlegend=True,
                hoverinfo="none",
                name=f"H{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