MCPcopy Create free account
hub / github.com/holoviz/hvplot / bivariate

Method bivariate

hvplot/plotting/core.py:742–826  ·  view source on GitHub ↗

A bivariate plot uses nested contours (or contours combined with color) to indicate regions of higher local density. Bivariate plots provide a convenient way to visualize a 2D distribution of values as a Kernel Density Estimate (KDE) and therefore provide a 2D

(
        self, x=None, y=None, colorbar=True, bandwidth=None, cut=3, filled=False, levels=10, **kwds
    )

Source from the content-addressed store, hash-verified

740 )
741
742 def bivariate(
743 self, x=None, y=None, colorbar=True, bandwidth=None, cut=3, filled=False, levels=10, **kwds
744 ):
745 """
746 A bivariate plot uses nested contours (or contours combined with color)
747 to indicate regions of higher local density.
748
749 Bivariate plots provide a convenient way to visualize a 2D distribution
750 of values as a Kernel Density Estimate (KDE) and therefore provide a 2D
751 extension to :py:meth:`~.kde`. KDE is a non-parametric way to estimate
752 the probability density function of a random variable.
753
754 The KDE works by placing a Gaussian kernel at each sample with the supplied
755 bandwidth, which are then summed to produce the density estimate. By default
756 the bandwidth is determined using the Scott's method, which usually produces
757 good results, but it may be overridden by an explicit value.
758
759 Bivariate plots can be a useful alternative to scatter plots, if the data
760 are too dense to plot each point individually.
761
762 Reference: https://hvplot.holoviz.org/ref/api/manual/hvplot.hvPlot.bivariate.html
763
764 Plotting options: https://hvplot.holoviz.org/ref/plotting_options/index.html
765
766 Parameters
767 ----------
768 x : string, optional
769 Field name to draw x-positions from. If not specified, the index is used.
770 y : string, optional
771 Field name to draw y-positions from
772 colorbar : boolean
773 Whether to display a colorbar
774 bandwidth : float, optional
775 Allows supplying explicit bandwidth value of the kernel for the
776 density estimate, rather than relying on Scott. Higher value
777 yields smoother contours. Default is None.
778 cut : float, optional
779 Draw the estimate to cut * bw from the extreme data points. Default is 3.
780 filled : bool, optional
781 If True the contours will be filled. Default is False.
782 levels : int or list, optional
783 The number of contour lines to draw or a list of scalar values used
784 to specify the contour levels. Default is 10.
785
786 **kwds : optional
787 Additional keywords arguments are documented in :ref:`plot-options`.
788 Run ``hvplot.help('bivariate')`` for the full method documentation.
789
790 Returns
791 -------
792 :class:`holoviews:holoviews.element.Bivariate` / Panel object
793 You can `print` the object to study its composition and run:
794
795 .. code-block::
796
797 import holoviews as hv
798 hv.help(the_holoviews_object)
799

Callers 1

test_bivariate_optsMethod · 0.45

Calls

no outgoing calls

Tested by 1

test_bivariate_optsMethod · 0.36