def append(self, x, y, scatter_kwargs, hist_kwargs=None, xhist_kwargs=None,
               yhist_kwargs=None, num_ticks=3, labels=None, hist_share=False,
               marginal_histograms=True):
        """
        Adds a new scatter to self.scatter_ax as well as marginal histograms
        for the same data, borrowing addtional room from the axes.

        Parameters
        ----------

        x, y : array-like
            Data to be plotted

        scatter_kwargs : dict
            Keyword arguments that are passed directly to scatter().

        hist_kwargs : dict
            Keyword arguments that are passed directly to hist(), for both the
            top and side histograms.

        xhist_kwargs, yhist_kwargs : dict
            Additional, margin-specific kwargs for the x or y histograms
            respectively.  These are used to update `hist_kwargs`

        num_ticks : int
            How many tick marks to use in each histogram's y-axis

        labels : array-like
            Optional NumPy array of labels that will be set on the collection
            so that they can be accessed by a callback function.

        hist_share : bool
            If True, then all histograms will share the same frequency axes.
            Useful for showing relative heights if you don't want to use the
            hist_kwarg `normed=True`

        marginal_histograms : bool
            Set to False in order to disable marginal histograms and just use
            as a normal scatterplot.
        """
        scatter_kwargs = scatter_kwargs or {}
        hist_kwargs = hist_kwargs or {}
        xhist_kwargs = xhist_kwargs or {}
        yhist_kwargs = yhist_kwargs or {}
        yhist_kwargs.update(dict(orientation='horizontal'))

        # Plot the scatter
        coll = self.scatter_ax.scatter(x, y, **scatter_kwargs)
        coll.labels = labels

        if not marginal_histograms:
            return

        xhk = _updatecopy(hist_kwargs, xhist_kwargs)
        yhk = _updatecopy(hist_kwargs, yhist_kwargs)

        axhistx = self.divider.append_axes(
            'top', size=self.hist_size,
            pad=self.pad, sharex=self.scatter_ax, sharey=self.xfirst_ax)

        axhisty = self.divider.append_axes(
            'right', size=self.hist_size,
            pad=self.pad, sharey=self.scatter_ax, sharex=self.yfirst_ax)

        axhistx.yaxis.set_major_locator(
            MaxNLocator(nbins=num_ticks, prune='both'))

        axhisty.xaxis.set_major_locator(
            MaxNLocator(nbins=num_ticks, prune='both'))

        if not self.xfirst_ax and hist_share:
            self.xfirst_ax = axhistx

        if not self.yfirst_ax and hist_share:
            self.yfirst_ax = axhisty

        # Keep track of which axes are which, because looking into fig.axes
        # list will get awkward....
        self.top_hists.append(axhistx)
        self.right_hists.append(axhisty)

        # Scatter will deal with NaN, but hist will not.  So clean the data
        # here.
        hx = _clean(x)
        hy = _clean(y)

        self.hxs.append(hx)
        self.hys.append(hy)

        # Only plot hists if there's valid data
        if len(hx) > 0:
            if len(hx) == 1:
                _xhk = _updatecopy(orig=xhk, update_with=dict(bins=[hx[0], hx[0]]), keys=['bins'])
                axhistx.hist(hx, **_xhk)
            else:
                axhistx.hist(hx, **xhk)
        if len(hy) > 0:
            if len(hy) == 1:
                _yhk = _updatecopy(orig=yhk, update_with=dict(bins=[hy[0], hy[0]]), keys=['bins'])
                axhisty.hist(hy, **_yhk)
            else:
                axhisty.hist(hy, **yhk)

        # Turn off unnecessary labels -- for these, use the scatter's axes
        # labels
        for txt in axhisty.get_yticklabels() + axhistx.get_xticklabels():
            txt.set_visible(False)

        for txt in axhisty.get_xticklabels():
            txt.set_rotation(-90)
dataset/ETHPy150Open daler/metaseq/metaseq/plotutils.py/MarginalHistScatter.append/original