seaborn.
lvplot
(x=None, y=None, hue=None, data=None, order=None, hue_order=None, orient=None, color=None, palette=None, saturation=0.75, width=0.8, dodge=True, k_depth='proportion', linewidth=None, scale='exponential', outlier_prop=None, ax=None, **kwargs)¶Draw a letter value plot to show distributions of large datasets.
Letter value (LV) plots are nonparametric estimates of the distribution of a dataset, similar to boxplots. LV plots are also similar to violin plots but without the need to fit a kernel density estimate. Thus, LV plots are fast to generate, directly interpretable in terms of the distribution of data, and easy to understand. For a more extensive explanation of letter value plots and their properties, see Hadley Wickham’s excellent paper on the topic:
http://vita.had.co.nz/papers/lettervalueplot.html
Input data can be passed in a variety of formats, including:
x
, y
, and/or hue
parameters.x
, y
, and hue
variables will determine how the data are plotted.plt.boxplot
(e.g. a 2d array or list of vectors)In most cases, it is possible to use numpy or Python objects, but pandas objects are preferable because the associated names will be used to annotate the axes. Additionally, you can use Categorical types for the grouping variables to control the order of plot elements.
Parameters:  x, y, hue : names of variables in
data : DataFrame, array, or list of arrays, optional
order, hue_order : lists of strings, optional
orient : “v”  “h”, optional
color : matplotlib color, optional
palette : palette name, list, or dict, optional
saturation : float, optional
width : float, optional
dodge : bool, optional
k_depth : “proportion”  “tukey”  “trustworthy”, optional
linewidth : float, optional
scale : “linear”  “exonential”  “area”
outlier_prop : float, optional
ax : matplotlib Axes, optional
kwargs : key, value mappings


Returns:  ax : matplotlib Axes

See also
violinplot
boxplot
Examples
Draw a single horizontal letter value plot:
>>> import seaborn as sns
>>> sns.set_style("whitegrid")
>>> tips = sns.load_dataset("tips")
>>> ax = sns.lvplot(x=tips["total_bill"])
Draw a vertical letter value plot grouped by a categorical variable:
>>> ax = sns.lvplot(x="day", y="total_bill", data=tips)
Draw a letter value plot with nested grouping by two categorical variables:
>>> ax = sns.lvplot(x="day", y="total_bill", hue="smoker",
... data=tips, palette="Set3")
Draw a letter value plot with nested grouping when some bins are empty:
>>> ax = sns.lvplot(x="day", y="total_bill", hue="time",
... data=tips, linewidth=2.5)
Control box order by passing an explicit order:
>>> ax = sns.lvplot(x="time", y="tip", data=tips,
... order=["Dinner", "Lunch"])
Draw a letter value plot for each numeric variable in a DataFrame:
>>> iris = sns.load_dataset("iris")
>>> ax = sns.lvplot(data=iris, orient="h", palette="Set2")
Use stripplot()
to show the datapoints on top of the boxes:
>>> ax = sns.lvplot(x="day", y="total_bill", data=tips)
>>> ax = sns.stripplot(x="day", y="total_bill", data=tips,
... size=4, jitter=True, color="gray")
Use factorplot()
to combine a lvplot()
and a
FacetGrid
. This allows grouping within additional categorical
variables. Using factorplot()
is safer than using FacetGrid
directly, as it ensures synchronization of variable order across facets:
>>> g = sns.factorplot(x="sex", y="total_bill",
... hue="smoker", col="time",
... data=tips, kind="lv",
... size=4, aspect=.7);