首页 > 解决方案 > 高斯分布的两个 Y 轴以及如何为分布着色

问题描述

我试图根据我的数据进行分配。所以,基本上我希望有线图并为每条线放置分布。到目前为止,我设法把这些放在一起。

import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
from matplotlib import cm

sns.set_theme(style="white")
data = ['N', 'O', 'P']

for x in data:
    ax1 = plt.plot(x, data=df1)
    ax2 = sns.distplot(df1[x], fit=norm, kde=False, norm_hist=False, bins=10, hist_kws=dict(alpha=0))

xticks = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28]
ticklabels = ['0','2', '4', '6', '8', '10', '12', '14', '16', '18', '20', '22', '24', '26', '28']
plt.xticks(xticks, ticklabels)

plt.xlim(0,50)
plt.ylim(0,0.1)
#plt.yscale("log")


plt.legend()
plt.show()

这只会导致我:

在此处输入图像描述

有没有可能做出我上面提到的东西?我想做这样的事情:

在此处输入图像描述

*但点将是分布

谢谢!是

标签: pythonseaborndistributiongaussian

解决方案


推荐阅读