我正在尝试重新创建下图的广泛功能:
(摘自EM Ozbudak,M.Thattai,I.Kurtser,AD Grossman和A.van Oudenaarden,Nat Genet 31,69(2002))
seaborn.jointplot
可以完成我所需的大部分操作,但似乎无法使用折线图,也没有明显的方法可以沿x轴隐藏直方图。有办法jointplot
去做我需要的吗?除此以外,还有其他合理简单的方法可以使用Seaborn创建这种情节吗?
事实证明,可以jointplot
通过直接使用基础JointGrid
对象来产生具有所需特征的修改:
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
x = np.linspace(0,8, 300)
y = (1 - np.exp(-x*5))*.5
ynoise= y + np.random.randn(len(x))*0.08
grid = sns.JointGrid(x, ynoise, ratio=3)
grid.plot_joint(plt.plot)
grid.ax_joint.plot(x, y, c='C0')
plt.sca(grid.ax_marg_y)
sns.distplot(grid.y, kde=False, vertical=True)
# override a bunch of the default JointGrid style options
grid.fig.set_size_inches(10,6)
grid.ax_marg_x.remove()
grid.ax_joint.spines['top'].set_visible(True)
输出:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句