Seaborn联合剧情节目注解

时间:2019-03-21 17:05:59

标签: python python-3.x matplotlib seaborn

我绘制了两个变量的联合图。我已将值传递给annot_kws参数,但情节中什么都没显示。

import numpy as np
import seaborn as sns

d1 = np.random.normal(10,1,100)
d2 = np.random.gamma(1,2,100)
col1 = sns.color_palette()[0]
col2 = sns.color_palette()[1]
col3 = sns.color_palette()[2]

def hexbin_jointplot_sns(d1, d2, col1, col2, bins='log'):
    """ """
    jp = sns.jointplot(d1, d2, kind="hex", annot_kws=dict(stat="r"), joint_kws=dict(bins=bins))

    # plot the 1:1 line
    ax = jp.ax_joint
    ax.plot(ax.get_xlim(), ax.get_ylim(), ls="--", c=".3", label="1:1")

    # color the marginal distributions separately
    for patch in jp.ax_marg_x.patches:
        patch.set_facecolor(col1)

    for patch in jp.ax_marg_y.patches:
        patch.set_facecolor(col2)

    return jp

hexbin_jointplot_sns(d1, d2, col1, col2, bins='log')

Plots with marginal coloured differently

如何在绘图中显示注释?

0 个答案:

没有答案