seaborn.JointGrid

    Set up the grid of subplots.

    参数:x, y:strings or vectors

    data:DataFrame, optional

    DataFrame when x and y are variable names.

    height:numeric

    ratio:numeric

    Ratio of joint axes size to marginal axes height.

    space:numeric, optional

    dropna:bool, optional

    {x, y}lim:two-tuples, optional

    See also

    High-level interface for drawing bivariate plots with several different default plot kinds.

    Examples

    Initialize the figure but don’t draw any plots onto it:

    1. >>> import seaborn as sns; sns.set(style="ticks", color_codes=True)
    2. >>> tips = sns.load_dataset("tips")
    3. >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips)

    Add plots using default parameters:

    http://seaborn.pydata.org/_images/seaborn-JointGrid-2.png

    Draw the join and marginal plots separately, which allows finer-level control other parameters:

    1. >>> import matplotlib.pyplot as plt
    2. >>> g = g.plot_joint(plt.scatter, color=".5", edgecolor="white")
    3. >>> g = g.plot_marginals(sns.distplot, kde=False, color=".5")

    Draw the two marginal plots separately:

    1. >>> import numpy as np
    2. >>> g = g.plot_joint(plt.scatter, color="m", edgecolor="white")
    3. >>> _ = g.ax_marg_x.hist(tips["total_bill"], color="b", alpha=.6,
    4. ... bins=np.arange(0, 60, 5))
    5. >>> _ = g.ax_marg_y.hist(tips["tip"], color="r", alpha=.6,
    6. ... orientation="horizontal",
    7. ... bins=np.arange(0, 12, 1))

    Add an annotation with a statistic summarizing the bivariate relationship:

    http://seaborn.pydata.org/_images/seaborn-JointGrid-5.png

    Use a custom function and formatting for the annotation

    1. >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips)
    2. >>> g = g.plot_joint(plt.scatter,
    3. ... color="g", s=40, edgecolor="white")
    4. >>> g = g.annotate(rsquare, template="{stat}: {val:.2f}",
    5. ... stat="$R^2$", loc="upper left", fontsize=12)

    Remove the space between the joint and marginal axes:

    1. >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips, space=0)
    2. >>> g = g.plot_joint(sns.kdeplot, cmap="Blues_d")
    3. >>> g = g.plot_marginals(sns.kdeplot, shade=True)

    http://seaborn.pydata.org/_images/seaborn-JointGrid-7.png

    Draw a smaller plot with relatively larger marginal axes:

    Set limits on the axes:

    1. >>> g = sns.JointGrid(x="total_bill", y="tip", data=tips,
    2. ... xlim=(0, 50), ylim=(0, 8))
    3. >>> g = g.plot_joint(sns.kdeplot, cmap="Purples_d")

    http://seaborn.pydata.org/_images/seaborn-JointGrid-9.png

    Methods

    | __init__(x, y[, data, height, ratio, space, …]) | Set up the grid of subplots. || annotate(func[, template, stat, loc]) | Annotate the plot with a statistic about the relationship. || (joint_func, marginal_func[, annot_func]) | Shortcut to draw the full plot. || plot_joint(func, kwargs) | Draw a bivariate plot of <cite>x</cite> and <cite>y</cite>. || (func, kwargs) | Draw univariate plots for <cite>x</cite> and <cite>y</cite> separately. || (args, *kwargs) | Wrap figure.savefig defaulting to tight bounding box. || set_axis_labels([xlabel, ylabel]) | Set the axis labels on the bivariate axes. |