hvPlot.kde#
- hvPlot.kde(y=None, by=None, **kwds)[source]#
The Kernel density estimate (kde) plot shows the distribution and spread of the data.
The kde and density plots are the same.
Reference: https://hvplot.holoviz.org/reference/tabular/kde.html
- Parameters:
- ystring or sequence
Field(s) in the data to compute distribution on. If not specified all numerical fields are used.
- bystring or sequence
Field(s) in the data to group by.
- bandwidthfloat, optional
The bandwidth of the kernel for the density estimate. Default is None.
- cut
Draw the estimate to cut * bw from the extreme data points.
- n_samplesint, optional
Number of samples to compute the KDE over. Default is 100.
- filled
Whether the bivariate contours should be filled. Default is True.
- kwdsoptional
Additional keywords arguments are documented in hvplot.help(‘kde’). See Plotting Options for more information.
- Returns:
holoviews.element.Distribution
/ Panel objectYou can print the object to study its composition and run:
import holoviews as hv hv.help(the_holoviews_object)
to learn more about its parameters and options.
References
HoloViews: https://holoviews.org/reference/elements/bokeh/Distribution.html
Pandas: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.plot.kde.html
Seaborn: https://seaborn.pydata.org/generated/seaborn.kdeplot.html
Wiki: https://en.wikipedia.org/wiki/Kernel_density_estimation
Examples
Lets display a ‘kde’ plot from wide data
import hvplot.pandas import numpy as np import pandas as pd df = pd.DataFrame({ 'x': [1, 2, 2.5, 3, 3.5, 4, 5], 'y': [4, 4, 4.5, 5, 5.5, 6, 6], }) df.hvplot.kde(color=["orange", "green"])
Lets display a ‘kde’ plot from long data using the ‘by’ attribute
import hvplot.pandas # noqa import pandas as pd import numpy as np df = pd.DataFrame({ 'category': list('xxxxxxxyyyyyyy'), 'value': [1, 2, 2.5, 3, 3.5, 4, 5, 4, 4, 4.5, 5, 5.5, 6, 6], }) df.hvplot.kde(by='category', filled=False)
Backend-specific styling options#
alpha, color, fill_alpha, fill_color, hover_alpha, hover_color, hover_fill_alpha, hover_fill_color, hover_line_alpha, hover_line_cap, hover_line_color, hover_line_dash, hover_line_dash_offset, hover_line_join, hover_line_width, line_alpha, line_cap, line_color, line_dash, line_dash_offset, line_join, line_width, muted, muted_alpha, muted_color, muted_fill_alpha, muted_fill_color, muted_line_alpha, muted_line_cap, muted_line_color, muted_line_dash, muted_line_dash_offset, muted_line_join, muted_line_width, nonselection_alpha, nonselection_color, nonselection_fill_alpha, nonselection_fill_color, nonselection_line_alpha, nonselection_line_cap, nonselection_line_color, nonselection_line_dash, nonselection_line_dash_offset, nonselection_line_join, nonselection_line_width, selection_alpha, selection_color, selection_fill_alpha, selection_fill_color, selection_line_alpha, selection_line_cap, selection_line_color, selection_line_dash, selection_line_dash_offset, selection_line_join, selection_line_width, visible
alpha, c, capstyle, color, ec, ecolor, edgecolor, facecolor, fc, fill, hatch, interpolate, joinstyle, linestyle, linewidth, lw, step
Examples#
TBD