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

        Parameters
        ----------
        Xt : ndarray of shape (n_samples, n_homology_dimensions, n_layers, \
            n_bins
            Collection of persistence landscapes, 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``
            Homology dimensions for which the landscape should be plotted.
            ``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": {
            "side": "bottom",
            "type": "linear",
            "ticks": "outside",
            "anchor": "y1",
            "showline": True,
            "zeroline": True,
            "showexponent": "all",
            "exponentformat": "e",
        },
        "yaxis1": {
            "side": "left",
            "type": "linear",
            "ticks": "outside",
            "anchor": "x1",
            "showline": True,
            "zeroline": True,
            "showexponent": "all",
            "exponentformat": "e",
        },
        "plot_bgcolor": "white",
        "title": f"Landscape representation of diagram {sample}",
    }

    Xt_sample = Xt[sample]
    for ix, dim in _homology_dimensions:
        layout_dim = layout.copy()
        layout_dim["title"] = (
            "Persistence landscape for homology " + "dimension {}".format(int(dim))
        )
        fig = gobj.Figure(layout=layout_dim)
        fig.update_xaxes(zeroline=True, linewidth=1, linecolor="black", mirror=False)
        fig.update_yaxes(zeroline=True, linewidth=1, linecolor="black", mirror=False)

        n_layers = Xt_sample.shape[1]
        for layer in range(n_layers):
            fig.add_trace(
                gobj.Scatter(
                    x=self.samplings_[dim],
                    y=Xt_sample[ix, layer],
                    mode="lines",
                    showlegend=True,
                    hoverinfo="none",
                    name=f"Layer {layer + 1}",
                )
            )

        # 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 persistence landscapes arranged
        as in the output of :meth:`transform`. Include homology in multiple
        dimensions.

        Parameters
        ----------
        Xt : ndarray of shape (n_samples, n_homology_dimensions, n_layers, \
            n_bins
            Collection of persistence landscapes, 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``
            Homology dimensions for which the landscape should be plotted.
            ``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": {"side": "bottom", "anchor": "y1", **layout_axes_common},
        "yaxis1": {"side": "left", "anchor": "x1", **layout_axes_common},
        "plot_bgcolor": "white",
    }

    Xt_sample = Xt[sample]
    n_layers = Xt_sample.shape[1]
    subplot_titles = [f"H{dim}" for _, dim in homology_dimensions_mapping]
    fig = make_subplots(
        rows=len(homology_dimensions_mapping), cols=1, subplot_titles=subplot_titles
    )
    has_many_homology_dim = len(homology_dimensions_mapping) - 1
    for i, (inv_idx, dim) in enumerate(homology_dimensions_mapping):
        hom_dim_str = f" ({subplot_titles[i]})" if has_many_homology_dim else ""
        for layer in range(n_layers):
            fig.add_trace(
                Scatter(
                    x=self.samplings_[dim],
                    y=Xt_sample[inv_idx, layer],
                    mode="lines",
                    showlegend=True,
                    hoverinfo="none",
                    name=f"Layer {layer + 1}{hom_dim_str}",
                ),
                row=i + 1,
                col=1,
            )

    fig.update_layout(
        title_text=f"Landscape representations of diagram {sample}", **layout.copy()
    )

    # 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