我绘制了两个变量的联合图。我已将值传递给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')
如何在绘图中显示注释?