seaborn.jointplot
This function provides a convenient interface to the class, with several canned plot kinds. This is intended to be a fairly lightweight wrapper; if you need more flexibility, you should use directly.
参数:x, y
:strings or vectors
data
:DataFrame, optional
DataFrame when
x
andy
are variable names.
kind
:{ “scatter” | “reg” | “resid” | “kde” | “hex” }, optional
Kind of plot to draw.
stat_func
:callable or None, optional
Deprecated
color
:matplotlib color, optional
height
:numeric, optional
Size of the figure (it will be square).
ratio
:numeric, optional
space
:numeric, optional
Space between the joint and marginal axes
:bool, optional
{x, y}lim
:two-tuples, optional
Axis limits to set before plotting.
{joint, marginal, annot}_kws
:dicts, optional
Additional keyword arguments for the plot components.
kwargs
:key, value pairings
Additional keyword arguments are passed to the function used to draw the plot on the joint Axes, superseding items in the
joint_kws
dictionary.
返回值:grid
:JointGrid
See also
The Grid class used for drawing this plot. Use it directly if you need more flexibility.
Draw a scatterplot with marginal histograms:
>>> import numpy as np, pandas as pd; np.random.seed(0)
>>> import seaborn as sns; sns.set(style="white", color_codes=True)
>>> tips = sns.load_dataset("tips")
Add regression and kernel density fits:
>>> g = sns.jointplot("total_bill", "tip", data=tips, kind="reg")
Replace the scatterplot with a joint histogram using hexagonal bins:
Replace the scatterplots and histograms with density estimates and align the marginal Axes tightly with the joint Axes:
>>> g = sns.jointplot("sepal_width", "petal_length", data=iris,
... kind="kde", space=0, color="g")
Draw a scatterplot, then add a joint density estimate:
>>> g = (sns.jointplot("sepal_length", "sepal_width",
... data=iris, color="k")
... .plot_joint(sns.kdeplot, zorder=0, n_levels=6))
Pass vectors in directly without using Pandas, then name the axes:
Draw a smaller figure with more space devoted to the marginal plots:
... height=5, ratio=3, color="g")
>>> g = sns.jointplot("petal_length", "sepal_length", data=iris,
... marginal_kws=dict(bins=15, rug=True),
... annot_kws=dict(stat="r"),