我想在一个六元图上固定x和y边缘分布的bin范围,因为我想用另一个分布的图覆盖边缘。
我可以使用以下命令设置垃圾桶的数量
g=sns.jointplot(x='age',y='value',data=joint_data, space=0, color='g', kind='hex',
stat_func = None, marginal_kws=dict(bins=num_bins))我可以使用以下命令设置沿两个轴的特定存储箱
g=sns.jointplot(x='age',y='value',data=joint_data, space=0, color='g', kind='hex',
stat_func = None, marginal_kws=dict(bins=numpy.linspace(x_min, x_max,100))但是我想分别为轴定义不同的范围。似乎没有单独的轴的marginal_kws。
发布于 2018-01-10 20:15:13
如果要分别访问两个边缘轴,则需要直接使用JointGrid,而不是更加用户友好的jointplot()。
看看seaborn's JointGrid documentation吧。尤其是标题为“分别绘制两个边缘图:”的示例是最相关的。基本上,您可以使用g.ax_marg_x和g.ax_marg_y获取对边缘轴的引用,然后可以在这些轴上使用任何您想要的绘图函数
g = sns.JointGrid(x="total_bill", y="tip", data=tips)
g = g.plot_joint(plt.scatter, color="m", edgecolor="white")
_ = g.ax_marg_x.hist(tips["total_bill"], color="b", alpha=.6,
bins=np.arange(0, 60, 5))
_ = g.ax_marg_y.hist(tips["tip"], color="r", alpha=.6,
orientation="horizontal",
bins=np.arange(0, 12, 1))https://stackoverflow.com/questions/48154910
复制相似问题