Seaborn JointGrid hexplot:纵横比问题

Seaborn JointGrid hexplot: aspect ratio issue

我正在尝试创建一个 JointGrid 图,但在正确设置纵横比方面遇到了一些问题。下面附上相关代码和图。不知道我做错了什么。

fig = plt.figure()
sns.set_style("ticks")
g = sns.JointGrid(X, Y, xlim=[0, max(X)], ylim=[0, max(Y)])
g.plot_marginals(sns.distplot, color=".5")
g.plot_joint(plt.hexbin, bins='log', gridsize=30, cmap=color)

以及输出图:

我不确定自己做错了什么;我看了这个:https://github.com/mwaskom/seaborn/issues/271 但那里的修复没有用。

谢谢!

我想通了;在这里发布我的解决方案,以防将来有人遇到同样的问题。

fig = plt.figure()
sns.set_style("ticks")
g = sns.JointGrid(X, Y)
g.plot_marginals(sns.distplot, color=".5")
g.plot_joint(plt.hexbin, bins='log', gridsize=30, cmap=color, extent=[0, np.max(X), 0, np.max(X)])

我基本上只是将它们的范围设置为等于 X 数组的最大值(它的最大值高于 Y,导致奇怪的纵横比)。

最终结果是这样的: