'seaborn joint plot not working with logarithmic axes
I'm trying to plot via:
g = sns.jointplot(x = etas, y = vs,
marginal_kws=dict(bins=100), space = 0)
g.ax_joint.set_xscale('log')
g.ax_joint.set_yscale('log')
g.ax_joint.set_xlim(0.01)
g.ax_joint.set_ylim(0.01)
g.ax_joint.set_xlabel(r'$\eta$')
g.ax_joint.set_ylabel("V")
plt.savefig("simple_scatter_plot_Seanborn.png",figsize=(8,8), dpi=150)
Which leaves me with the following image: plot
This is not what I want. Why are the histograms filled at the end? There are no data points there so I don't get it...
Solution 1:[1]
You're setting a log scale on the matplotlib axes but by the time you are doing that seaborn has already computed the histogram. So the equal-width bins in linear space appear to have different widths; the lowest bin has a narrow range in terms of actual values, but that takes up a lot of space on the horizontal plot.
Solution: pass log_scale=True to the histograms:
sns.jointplot(data=planets, x="orbital_period", y="distance", marginal_kws=dict(log_scale=True))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mwaskom |

